mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Clone questionMark and dotdotdot token (#58263)
Co-authored-by: Armando Aguirre Sepulveda <araguir@microsoft.com>
This commit is contained in:
@@ -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(
|
||||
|
||||
29
tests/cases/fourslash/completionCloneQuestionToken.ts
Normal file
29
tests/cases/fourslash/completionCloneQuestionToken.ts
Normal 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,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user