Clone questionMark and dotdotdot token (#58263)

Co-authored-by: Armando Aguirre Sepulveda <araguir@microsoft.com>
This commit is contained in:
Armando Aguirre 2024-04-24 10:20:59 -07:00 committed by GitHub
parent 49762119f3
commit 5b69fdf541
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 1 deletions

View File

@ -6689,7 +6689,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
return node;
}
return setTextRange(context, factory.cloneNode(visitEachChild(node, deepCloneOrReuseNode, /*context*/ undefined, deepCloneOrReuseNodes)), node);
return setTextRange(context, factory.cloneNode(visitEachChild(node, deepCloneOrReuseNode, /*context*/ undefined, deepCloneOrReuseNodes, deepCloneOrReuseNode)), node);
}
function deepCloneOrReuseNodes(

View File

@ -0,0 +1,29 @@
/// <reference path='fourslash.ts'/>
// @Filename: /file2.ts
//// type TCallback<T = any> = (options: T) => any;
//// type InKeyOf<E> = { [K in keyof E]?: TCallback<E[K]>; };
//// export class Bar<A> {
//// baz(a: InKeyOf<A>): void { }
//// }
// @Filename: /file1.ts
//// import { Bar } from './file2';
//// type TwoKeys = Record<'a' | 'b', { thisFails?: any; }>
//// class Foo extends Bar<TwoKeys> {
//// /**/
//// }
verify.completions({
marker: "",
includes: {
name: "baz",
insertText: "baz(a: { a?: (options: { thisFails?: any; }) => any; b?: (options: { thisFails?: any; }) => any; }): void {\n}",
filterText: "baz",
},
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithClassMemberSnippets: true,
},
});