fix(compiler-cli): Refactor getTsTypeFromBuiltinType (#33778)
This commit fixes a few issues with helper method `getBuiltInTypeFromTsType`. 1. The function is wrongly named. It should be the other way round. 2. The ts.Type returned by the function should not contain any value. This is because for some data types like Number and String, the SourceFile (context.node) is not the correct value. Value is never needed for program correctness in this case. PR Close #33778
This commit is contained in:

committed by
Alex Rickabaugh

parent
1d3aae6f92
commit
cbb1d9f2bb
@ -53,10 +53,10 @@ describe('symbol query', () => {
|
||||
const tests: Array<[BuiltinType, boolean, ts.TypeFlags?]> = [
|
||||
// builtinType, throws, want
|
||||
[BuiltinType.Any, false, ts.TypeFlags.Any],
|
||||
[BuiltinType.Boolean, false, ts.TypeFlags.BooleanLiteral],
|
||||
[BuiltinType.Boolean, false, ts.TypeFlags.Boolean | ts.TypeFlags.Union],
|
||||
[BuiltinType.Null, false, ts.TypeFlags.Null],
|
||||
[BuiltinType.Number, false, ts.TypeFlags.NumberLiteral],
|
||||
[BuiltinType.String, false, ts.TypeFlags.StringLiteral],
|
||||
[BuiltinType.Number, false, ts.TypeFlags.Number],
|
||||
[BuiltinType.String, false, ts.TypeFlags.String],
|
||||
[BuiltinType.Undefined, false, ts.TypeFlags.Undefined],
|
||||
[BuiltinType.Unbound, true],
|
||||
[BuiltinType.Other, true],
|
||||
|
Reference in New Issue
Block a user