-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScript
Milestone
Description
TypeScript Version: 4.0.0-dev.20200622
Search Terms: polymorphic this mapped type
Expected behavior: b.foo()
returns B
Actual behavior: b.foo()
returns A
even though the tooltip on foo
says it returns this
Related Issues: None
Code
interface A {
foo(): this
}
interface B extends Pick<A, keyof A> {
bar(): this
}
declare let b: B;
b.foo().bar() // error
Output
"use strict";
b.foo().bar(); // error
Compiler Options
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"useDefineForClassFields": false,
"alwaysStrict": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"downlevelIteration": false,
"noEmitHelpers": false,
"noLib": false,
"noStrictGenericChecks": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"esModuleInterop": true,
"preserveConstEnums": false,
"removeComments": false,
"skipLibCheck": false,
"checkJs": false,
"allowJs": false,
"declaration": true,
"experimentalDecorators": false,
"emitDecoratorMetadata": false,
"target": "ES2017",
"module": "ESNext"
}
}
Playground Link: Provided
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript