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
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:
Replace keyof T with Extract<keyof T, string>
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
Most helpful comment
@MaxBinnewies Thanks for reporting. @andys8 Thanks for providing more details :)
For now you can also set
skipLibChecktruein your tsconfig to omit the error.