mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 02:15:12 -06:00
Fix services' type's isLiteral implementation (#50929)
* fix services' type's isLiteral * update literal completions tests * remove booleans from literals
This commit is contained in:
parent
c1e9afd542
commit
fdcb2ffd1b
@ -511,7 +511,7 @@ namespace ts {
|
||||
return !!(this.flags & TypeFlags.UnionOrIntersection);
|
||||
}
|
||||
isLiteral(): this is LiteralType {
|
||||
return !!(this.flags & TypeFlags.StringOrNumberLiteral);
|
||||
return !!(this.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral | TypeFlags.BigIntLiteral));
|
||||
}
|
||||
isStringLiteral(): this is StringLiteralType {
|
||||
return !!(this.flags & TypeFlags.StringLiteral);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////const x: 0 | "one" = /**/;
|
||||
////const y: 0 | "one" | 1n = /*1*/;
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
@ -10,3 +11,12 @@ verify.completions({
|
||||
],
|
||||
isNewIdentifierLocation: true,
|
||||
});
|
||||
verify.completions({
|
||||
marker: "1",
|
||||
includes: [
|
||||
{ name: "0", kind: "string", text: "0" },
|
||||
{ name: '"one"', kind: "string", text: '"one"' },
|
||||
{ name: "1n", kind: "string", text: "1n" },
|
||||
],
|
||||
isNewIdentifierLocation: true,
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user