fix(language-service): return the js primitive type name (#34177)
PR Close #34177
This commit is contained in:
parent
2ebaa51514
commit
148a060daa
@ -246,7 +246,13 @@ class TypeWrapper implements Symbol {
|
|||||||
|
|
||||||
get name(): string {
|
get name(): string {
|
||||||
const symbol = this.tsType.symbol;
|
const symbol = this.tsType.symbol;
|
||||||
return (symbol && symbol.name) || '<anonymous>';
|
if (symbol) {
|
||||||
|
return symbol.name;
|
||||||
|
} else {
|
||||||
|
// the js primitive type(e.g. 'string') doesn't have Symbol.
|
||||||
|
// use the ts.TypeChecker to get the type name.
|
||||||
|
return this.context.checker.typeToString(this.tsType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly kind: DeclarationKind = 'type';
|
public readonly kind: DeclarationKind = 'type';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user