mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
completion for return const assertion. (#41475)
This commit is contained in:
parent
bce412cb15
commit
3442151f9d
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
17
tests/cases/fourslash/completionReturnConstAssertion.ts
Normal file
17
tests/cases/fourslash/completionReturnConstAssertion.ts
Normal 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" },
|
||||
],
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user