Bug Report Checklist
Expected
Calling isPropertyReadonlyInType({ abc: 42 }, "abc") in the following code block should not crash:
declare const fooFactory: <T>(x: readonly T[]) => (f: (x: T) => void) => void;
fooFactory([{ abc: 42 }])((x) => { });
Actual
typescript-eslint/typescript-eslint#11289:
TypeError: Cannot read properties of undefined (reading 'checkFlags')
Occurred while linting /Users/josh/repos/typescript-eslint/packages/eslint-plugin/tests/fixtures/file.ts:4
Rule: "@rule-tester/prefer-readonly-parameter-types"
❯ isTransientSymbolLinksFlagSet ../../node_modules/ts-api-utils/lib/index.cjs:143:26
❯ isInConstContext ../../node_modules/ts-api-utils/lib/index.cjs:994:16
❯ ../../node_modules/ts-api-utils/lib/index.cjs:1088:464
❯ symbolHasReadonlyDeclaration ../../node_modules/ts-api-utils/lib/index.cjs:1087:145
❯ ../../node_modules/ts-api-utils/lib/index.cjs:1172:5
❯ isReadonlyPropertyIntersection ../../node_modules/ts-api-utils/lib/index.cjs:1154:23
❯ Object.isPropertyReadonlyInType ../../node_modules/ts-api-utils/lib/index.cjs:1059:41
❯ isTypeReadonlyObject ../type-utils/dist/isTypeReadonly.js:138:25
Additional Info
The specific crash is in:
|
export function isTransientSymbolLinksFlagSet( |
|
links: ts.TransientSymbolLinks, |
|
flag: ts.CheckFlags, |
|
): boolean { |
|
return isFlagSet(links.checkFlags, flag); |
|
} |
...but the root is that undefined is getting used instead of a value, somewhere in the stack.
💖
Bug Report Checklist
mainbranch of the repository.Expected
Calling
isPropertyReadonlyInType({ abc: 42 }, "abc")in the following code block should not crash:Actual
typescript-eslint/typescript-eslint#11289:
Additional Info
The specific crash is in:
ts-api-utils/src/flags.ts
Lines 96 to 101 in 7935007
...but the root is that
undefinedis getting used instead of a value, somewhere in the stack.💖