Consider Branding Schema.Data Wrapped Types for Better Type Safety

i feel like this has been discussed before but should we not brand Schema.Data wrapped .Types? this way when a schema like
const A = Schema.Struct({ arr: Schema.Data(Schema.Array(Schema.Number)) })
const a = A.make({ arr: [] })
/*
14:15:29 - Found 0 errors. Watching for file changes.
{
  _id: 'ParseError',
  message: '{ readonly arr: Data<ReadonlyArray<number>> }\n' +
    '└─ ["arr"]\n' +
    '   └─ Expected Data<ReadonlyArray<number>>, actual []'
}
*/

this would now show a type error instead of just runtime erroring.
Was this page helpful?