completion for return const assertion. (#41475)

This commit is contained in:
Song Gao 2020-12-22 17:16:30 +08:00 committed by GitHub
parent bce412cb15
commit 3442151f9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -24423,10 +24423,7 @@ namespace ts {
return undefined;
function tryFindWhenConstTypeReference(node: Expression) {
if(isCallLikeExpression(node.parent)){
return getContextualTypeForArgument(node.parent, node);
}
return undefined;
return getContextualType(node);
}
}

View File

@ -0,0 +1,17 @@
/// <reference path="fourslash.ts" />
//// type T = {
//// foo1: 1;
//// foo2: 2;
//// }
//// function F(x: ()=>T) {}
//// F(()=>({/*1*/} as const))
verify.completions({
marker: "1",
exact: [
{ name: "foo1", text: "(property) foo1: 1" },
{ name: "foo2", text: "(property) foo2: 2" },
],
});