Search Terms:
type alias, import, display, quickinfo, intellisense
Code
// @Filename: file1.tsexporttypeComplicatedType<T,U>={[KinExclude<keyofT,U>]: T[K]}// could be anything hereexportdeclarefunctiongetComplicatedType<T,UextendskeyofT>(arg: T,exclude: U): ComplicatedType<T,U>// @Filename: file2.tsimport{getComplicatedType}from"./file1"interfaceSomeInterface{a: stringb<T>(arg: T): T,c: {c2: string}|{c3: number},d?: boolean}declareconsttest: SomeInterfaceconstresult=getComplicatedType(test,"a")// quickinfo on result currently displays something like:/* const result: { b: <T>(arg: T) => T; c: { c2: string; } | { c3: number; }; d: boolean | undefined;} */Current behavior:
The quick info type shown for result is a fully expanded anonymous type because ComplicatedType is not in scope in file2. Importing ComplicatedType in file2 makes quick info display const result: ComplicatedType<SomeInterface, "a">, but I don't think it's common to import a type alias purely for the quick info benefit if it isn't actually used anywhere in the file.
While the example above isn't that bad, in some cases (#18754, #23458) the fully expanded types can be so large that they actually cause a performance issue for the language service.
Suggested behavior:
Use import types from #22592 to display an accurate qualified reference to ComplicatedType. So in the example above quick info for result could instead display something like:
constresult: import("./file1").ComplicatedType<SomeInterface,"a">Which, although a little verbose, would be much more readable than many fully expanded types.
Related Issues:
#22592 added import types.
#18754, #23458, #6070, #13095 - Various issues related to the display of types.
Search Terms:
type alias, import, display, quickinfo, intellisense
Code
Current behavior:
The quick info type shown for
resultis a fully expanded anonymous type becauseComplicatedTypeis not in scope infile2. ImportingComplicatedTypeinfile2makes quick info displayconst result: ComplicatedType<SomeInterface, "a">, but I don't think it's common to import a type alias purely for the quick info benefit if it isn't actually used anywhere in the file.While the example above isn't that bad, in some cases (#18754, #23458) the fully expanded types can be so large that they actually cause a performance issue for the language service.
Suggested behavior:
Use
importtypes from #22592 to display an accurate qualified reference toComplicatedType. So in the example above quick info forresultcould instead display something like:Which, although a little verbose, would be much more readable than many fully expanded types.
Related Issues:
#22592 added
importtypes.#18754, #23458, #6070, #13095 - Various issues related to the display of types.