You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix contextually typed object literal completions where the object being edited affects its own inference (#36556)
* Conditionally elide a parameter from contextual type signature calculation
* Slightly different approach to forbid inference to specific expressions
* Handle nested literals and mapped types correctly
* Delete unused cache
* Rename ContextFlags.BaseConstraint and related usage
* Add tests from my PR
* Update ContextFlags comment
Co-Authored-By: Wesley Wigham <wwigham@gmail.com>
* Update comments and fourslash triple slash refs
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
Copy file name to clipboardExpand all lines: src/compiler/types.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3611,7 +3611,8 @@ namespace ts {
3611
3611
None=0,
3612
3612
Signature=1<<0,// Obtaining contextual signature
3613
3613
NoConstraints=1<<1,// Don't obtain type variable constraints
3614
-
BaseConstraint=1<<2,// Use base constraint type for completions
3614
+
Completions=1<<2,// Ignore inference to current node and parent nodes out to the containing call for completions
3615
+
3615
3616
}
3616
3617
3617
3618
// NOTE: If modifying this enum, must modify `TypeFormatFlags` too!
@@ -4249,6 +4250,7 @@ namespace ts {
4249
4250
outerTypeParameters?: TypeParameter[];// Outer type parameters of anonymous object type
4250
4251
instantiations?: Map<Type>;// Instantiations of generic type alias (undefined if non-generic)
4251
4252
isExhaustive?: boolean;// Is node an exhaustive switch statement
4253
+
skipDirectInference?: true;// Flag set by the API `getContextualType` call on a node when `Completions` is passed to force the checker to skip making inferences to a node's type
0 commit comments