Skip to content

Commit 5b69fdf

Browse files
Armando AguirreArmando Aguirre Sepulveda
Armando Aguirre
and
Armando Aguirre Sepulveda
authored
Clone questionMark and dotdotdot token (#58263)
Co-authored-by: Armando Aguirre Sepulveda <araguir@microsoft.com>
1 parent 4976211 commit 5b69fdf

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6689,7 +6689,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
66896689
if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
66906690
return node;
66916691
}
6692-
return setTextRange(context, factory.cloneNode(visitEachChild(node, deepCloneOrReuseNode, /*context*/ undefined, deepCloneOrReuseNodes)), node);
6692+
return setTextRange(context, factory.cloneNode(visitEachChild(node, deepCloneOrReuseNode, /*context*/ undefined, deepCloneOrReuseNodes, deepCloneOrReuseNode)), node);
66936693
}
66946694

66956695
function deepCloneOrReuseNodes(
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @Filename: /file2.ts
4+
//// type TCallback<T = any> = (options: T) => any;
5+
//// type InKeyOf<E> = { [K in keyof E]?: TCallback<E[K]>; };
6+
//// export class Bar<A> {
7+
//// baz(a: InKeyOf<A>): void { }
8+
//// }
9+
10+
// @Filename: /file1.ts
11+
//// import { Bar } from './file2';
12+
//// type TwoKeys = Record<'a' | 'b', { thisFails?: any; }>
13+
//// class Foo extends Bar<TwoKeys> {
14+
//// /**/
15+
//// }
16+
17+
verify.completions({
18+
marker: "",
19+
includes: {
20+
name: "baz",
21+
insertText: "baz(a: { a?: (options: { thisFails?: any; }) => any; b?: (options: { thisFails?: any; }) => any; }): void {\n}",
22+
filterText: "baz",
23+
},
24+
isNewIdentifierLocation: true,
25+
preferences: {
26+
includeCompletionsWithInsertText: true,
27+
includeCompletionsWithClassMemberSnippets: true,
28+
},
29+
});

0 commit comments

Comments
 (0)