jacob-alford / schemata-ts

An all-inclusive schema engine featuring schemata inspired by io-ts and validators.js. Written for TypeScript with fp-ts
https://schemata.jacob-alford.dev/
MIT License
34 stars 1 forks source link

TypeScript 4.7: error TS1383: Only named exports may use 'export type' #312

Closed secobarbital closed 10 months ago

secobarbital commented 11 months ago

It looks like the library is using export type * from ... syntax, which is only supported in TypeScript 5 and above. The README has a badge indicating that it is compatible with TypeScript 4.5+. We are using TypeScript 4.7 and had to downgrade to schemata-ts@2.0.4 as a workaround but cannot use .extend as a result.

Would be nice to support 4.5+ as documented.

node_modules/schemata-ts/internal/either.d.ts:1:1 - error TS1383: Only named exports may use 'export type'.
1 export type * from 'fp-ts/Either';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/schemata-ts/internal/option.d.ts:1:1 - error TS1383: Only named exports may use 'export type'.
1 export type * from 'fp-ts/Option';
jacob-alford commented 10 months ago

Ahh good catch, that's my bad. I didn't realize that was so recent a TS feature. I might be able to simply export * with no breaking change.

Also, I'm curious, what's stopping you from using TypeScript 5+?

jacob-alford commented 10 months ago

This should now be fixed in version 2.2.2. Let me know if it works for you!

secobarbital commented 10 months ago

Also, I'm curious, what's stopping you from using TypeScript 5+?

TypeORM :(

The version of TypeORM we are on is not supported by TS4.8 and above. Hope to find time to knock down those dominoes.

secobarbital commented 10 months ago

This should now be fixed in version 2.2.2. Let me know if it works for you!

Yes, it does! Thank you! And thank you for the library, too!