-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
🔎 Search Terms
allowJs, checkJs, type imports via JSDoc, generic functions, no compile, inconsistent behavior, inline type, arrow
💻 Code
./privateApi.ts
export type IFn = <T>(m : T[][]) => T[][];
const inTsArrow = <T>(m : T[][]) : T[][] => {
return m;
}
inTsArrow([[1]]); // no error gets linted as expected
function inTs<T>(m : T[][]) : T[][] {
return m;
}
inTs([[1]]); // no error gets linted as expected./index.js
/**@type {import("./privateApi").IFn}*/
export function inJs(m) {
return m;
}
inJs([[1]]); // lints error. Why?
/**@type {import("./privateApi").IFn}*/
const inJsArrow = (m) => {
return m;
}
inJsArrow([[1]]); // no error gets linted as expected./tsconfig.json
{
"compilerOptions": {
"checkJs": true,
"allowJs": true,
"target": "ESNext",
"strict": true,
"noEmit": true,
"rootDir": "./",
"skipDefaultLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
},
"include": [
"./**/*.ts",
"./**/*.js"
],
"exclude": [
"node_modules",
"TBD"
]
}Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue