Uniforms: Ts error: Unused '@ts-expect-error' directive. TS2578

Created on 15 Mar 2021  路  4Comments  路  Source: vazco/uniforms

I'm, using typescript 4.2.2
uniforms 3.2.1

/node_modules/uniforms-bootstrap4/src/gridClassName.ts
TypeScript error in /node_modules/uniforms-bootstrap4/src/gridClassName.ts(47,9):
Unused '@ts-expect-error' directive. TS2578

45 |       (Object.keys(grid) as GridSize[])
46 |         .sort(compareSizeClass)

47 | // @ts-expect-error Weird type refinement problem.
| ^
48 | .map(size => gridClassNamePart(size, grid[size], side))
49 | .join(' ')
50 | );

bug

All 4 comments

Hey there, thanks for the report @cesarve77

It seems like the issue was introduced here: https://github.com/vazco/uniforms/pull/887/files#diff-3376e8270059d06746fecc5dc4bf793f82f7bd219808eb943e9a1d503a44e971R47

Seems like new typescript version no longer has a problem with the types there (we are using 4.1.3 in uniforms). So a workaround for you for now: downgrade the version to 4.1.3 where it should hopefully work.

Update:

I tried updating TypeScript version to the newest one so that we can also get rid of this directive but I unfortunately encountered a problem which seems to be a bug in TypeScript 4.2+ reported here.

Reproduction of the broken declaration files that were generated after bumping up the version here.

We'll have to decide if we want to create a temporary PR with a band-aid solution by changing this back to ignore-error or wait for the TS fix.

Edit: We've decided that we will hold off with fixing it until an actual TS fix is released. For anyone encountering this issue, please use a TS version of lower than 4.2 or use skipLibCheck

@wadamek65: have you tried it recently?

@radekmie @cesarve77

I came back to this today and the problem still seems to exists on TS version 4.2.4 and also on 4.3 beta. The issue I linked in my previous comment is still open. We will have to keep monitoring this as it is still blocking us from updating the TS version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thearabbit picture thearabbit  路  8Comments

rafahoro picture rafahoro  路  3Comments

cyclops24 picture cyclops24  路  6Comments

vfonic picture vfonic  路  3Comments

todda00 picture todda00  路  7Comments