fabian-hiller / valibot

The modular and type safe schema library for validating structural data 🤖
https://valibot.dev
MIT License
6.21k stars 199 forks source link

Error when building #547

Closed alphadever closed 4 months ago

alphadever commented 6 months ago

I am getting the following error when running my node project node_modules/valibot/dist/index.d.ts(2170,27): error TS1139: Type parameter declaration expected. [tsc ] node_modules/valibot/dist/index.d.ts(2170,42): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(2170,65): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(2170,74): error TS1005: ')' expected. [tsc ] node_modules/valibot/dist/index.d.ts(2170,94): error TS1109: Expression expected. [tsc ] node_modules/valibot/dist/index.d.ts(2170,108): error TS1005: ';' expected. [tsc ] node_modules/valibot/dist/index.d.ts(2170,109): error TS1128: Declaration or statement expected. [tsc ] node_modules/valibot/dist/index.d.ts(2197,32): error TS1139: Type parameter declaration expected. [tsc ] node_modules/valibot/dist/index.d.ts(2197,47): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(2197,70): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(2197,79): error TS1005: ')' expected. [tsc ] node_modules/valibot/dist/index.d.ts(2197,99): error TS1109: Expression expected. [tsc ] node_modules/valibot/dist/index.d.ts(2197,113): error TS1005: ';' expected. [tsc ] node_modules/valibot/dist/index.d.ts(2197,114): error TS1128: Declaration or statement expected. [tsc ] node_modules/valibot/dist/index.d.ts(3358,55): error TS1139: Type parameter declaration expected. [tsc ] node_modules/valibot/dist/index.d.ts(3358,71): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(3358,87): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(3358,96): error TS1109: Expression expected. [tsc ] node_modules/valibot/dist/index.d.ts(3358,104): error TS1005: ')' expected. [tsc ] node_modules/valibot/dist/index.d.ts(3358,123): error TS1005: ';' expected. [tsc ] node_modules/valibot/dist/index.d.ts(3358,125): error TS1434: Unexpected keyword or identifier. [tsc ] node_modules/valibot/dist/index.d.ts(3358,134): error TS1128: Declaration or statement expected. [tsc ] node_modules/valibot/dist/index.d.ts(3358,135): error TS1128: Declaration or statement expected. [tsc ] node_modules/valibot/dist/index.d.ts(3381,65): error TS1139: Type parameter declaration expected. [tsc ] node_modules/valibot/dist/index.d.ts(3381,81): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(3381,102): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(3381,111): error TS1109: Expression expected. [tsc ] node_modules/valibot/dist/index.d.ts(3381,119): error TS1005: ')' expected. [tsc ] node_modules/valibot/dist/index.d.ts(3381,138): error TS1005: ';' expected. [tsc ] node_modules/valibot/dist/index.d.ts(3381,140): error TS1434: Unexpected keyword or identifier. [tsc ] node_modules/valibot/dist/index.d.ts(3381,149): error TS1128: Declaration or statement expected. [tsc ] node_modules/valibot/dist/index.d.ts(3381,150): error TS1128: Declaration or statement expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,58): error TS1139: Type parameter declaration expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,77): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,92): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,103): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,106): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,114): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,131): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,144): error TS1005: ')' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,168): error TS1109: Expression expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,182): error TS1005: ';' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5066,183): error TS1128: Declaration or statement expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,58): error TS1139: Type parameter declaration expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,77): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,92): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,103): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,106): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,114): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,131): error TS1005: ',' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,144): error TS1005: ')' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,168): error TS1109: Expression expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,182): error TS1005: ';' expected. [tsc ] node_modules/valibot/dist/index.d.ts(5226,183): error TS1128: Declaration or statement expected.

fabian-hiller commented 6 months ago

Does it work with the skipLipCheck option enabled?

TithSambath commented 6 months ago

I am facing the same thing when trying to build. it working fine though on dev

image

I am also configure skipLibCheck on my tsconfig.json @fabian-hiller

image

TithSambath commented 6 months ago

After rechecking valibot doc and my package.json again, I saw my typescript version was below the minimal requirement specify on the doc.

image

Upgrade typescript version >= 5.0.2 , the issue is resolve for me.

image

fabian-hiller commented 6 months ago

Are you able to upgrade?

maranomynet commented 6 months ago

I'm seeing these errors in several projects using typescript v4 (yes, with "skipLibCheck": true), and upgrading them to v5+ is not easy, as it would require upgrading several of their dependencies by major versions.

They will be upgraded (hard to know when) and until then we can't use valibot.

I've found that when writing a library it's generally best to build it with a slightly older, more widely adopted version of typescript.

You might want to consider lowering the typesript version requirement, as a non-breaking feature upgrade for valibot.

fabian-hiller commented 6 months ago

Valibot requires one or two features that were introduced with TypeScript >=v5. I do not plan to downgrade the requirement, but what I can consider is releasing a version of Valibot that supports TypeScript v4 as soon as Valibot reaches v1.

fabian-hiller commented 4 months ago

I will close this issue, but will reopen it if there is a good reason in the future.