-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issuecheckJsRelates to checking JavaScript using TypeScriptRelates to checking JavaScript using TypeScript
Milestone
Description
TypeScript Version: 3.0.0-dev.20180712
Search Terms:
Code
// @checkJs: true
// @allowJs: true
// @filename: test.js
/** @type {<T>(param?: T) => T | undefined} */
function typed(param) {
return param;
}
typed(1);Expected behavior:
Either param doesn't get it's type from the @type tag or the type parameter T applies to the function.
Actual behavior:
Argument of type '1' is not assignable to parameter of type 'T | undefined'.
Playground Link: not possible
Related Issues: #25525
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issuecheckJsRelates to checking JavaScript using TypeScriptRelates to checking JavaScript using TypeScript