You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
describe.each([['foo'], ['bar']] as const) throws an error.
failing-example.test.ts:8:15 - error TS2345: Argument of type 'readonly [readonly ["foo"], readonly ["bar"]]' is not assignable to parameter of type 'EachTable'.
Property 'raw' is missing in type 'readonly [readonly ["foo"], readonly ["bar"]]' but required in type 'TemplateStringsArray'.
8 describe.each([['foo'], ['bar']] as const)("The property %s", (prop) => {
Additional context
When importing types from @types/jest, the error does not occur, as can be seen from working-example.test.ts. It seems like the type definition in @jest/globals only defines types for a table with a template string, not for an array.
Leaving out const in the each call solves the type problem, but is not a solution overall, as it leads to a different type error later on.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Version
27.4.7
Steps to reproduce
https://github.com/dbartholomae/jest-global-import-example
npm test
Expected behavior
No error
Actual behavior
describe.each([['foo'], ['bar']] as const)
throws an error.Additional context
When importing types from
@types/jest
, the error does not occur, as can be seen fromworking-example.test.ts
. It seems like the type definition in@jest/globals
only defines types for a table with a template string, not for an array.Leaving out
const
in theeach
call solves the type problem, but is not a solution overall, as it leads to a different type error later on.Environment
The text was updated successfully, but these errors were encountered: