Sequelize-typescript: build fails with latest typescript version

Created on 1 Jun 2018  Â·  5Comments  Â·  Source: RobinBuschmann/sequelize-typescript

Hello,

Our build fails on Kubernetes, but not locally, with the following error:
Step #0: node_modules/sequelize-typescript/lib/utils/types.d.ts(9,16): error TS2344: Type ‘keyof T’ does not satisfy the constraint ‘string’.
Step #0: Type ‘string | number | symbol’ is not assignable to type ‘string’.
Step #0: Type ‘number’ is not assignable to type ‘string’.

Turns out Kubernetes pulled the latest typescript version from 9 hours ago: 2.9.1
We set typescript to the previous version (2.8.4) and the build works.

Is this a bug with sequelize-typescript, typescript, or something else entirely?

Thanks,
Max

Most helpful comment

@MaxBinnewies Thanks for reporting. @andys8 Thanks for providing more details :)

For now you can also set skipLibCheck true in your tsconfig to omit the error.

All 5 comments

Can confirm the issue.

See https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#support-number-and-symbol-named-properties-with-keyof-and-mapped-types for the cause.

There are two possible solutions:

Solution 1

Replace keyof T with Extract<keyof T, string>

Solution 2

Enforce old behavior with --keyofStringsOnly compiler option.

@MaxBinnewies Thanks for reporting. @andys8 Thanks for providing more details :)

For now you can also set skipLibCheck true in your tsconfig to omit the error.

Thanks @RobinBuschmann for the quick fix. When is the next release planned to make it available?

@andys8 Sry for the late reply: Is released now under [email protected] or simply sequelize-typescript@next

Was this page helpful?
0 / 5 - 0 ratings