Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cesarve77 opened this issue Mar 15, 2021 · 4 comments · Fixed by #949
Closed

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

cesarve77 opened this issue Mar 15, 2021 · 4 comments · Fixed by #949
Assignees
Labels
Type: Bug Bug reports and their fixes
Milestone

Comments

@cesarve77
Copy link
Contributor

cesarve77 commented Mar 15, 2021

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 | );

@wadamek65
Copy link
Contributor

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.

@wadamek65 wadamek65 self-assigned this Mar 16, 2021
@wadamek65 wadamek65 added the Type: Bug Bug reports and their fixes label Mar 16, 2021
@wadamek65
Copy link
Contributor

wadamek65 commented Mar 22, 2021

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

@radekmie radekmie added this to the v3.4 milestone Apr 30, 2021
@radekmie
Copy link
Contributor

@wadamek65: have you tried it recently?

@wadamek65
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants