Skip to content

Commit 6758cd9

Browse files
committed
Update TypeFlags order per tsgo PR 1226
1 parent c356203 commit 6758cd9

15 files changed

+64
-64
lines changed

src/compiler/types.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6284,18 +6284,18 @@ export const enum TypeFlags {
62846284
UniqueESSymbol = 1 << 14, // unique symbol
62856285
EnumLiteral = 1 << 15, // Always combined with StringLiteral, NumberLiteral, or Union
62866286
Enum = 1 << 16, // Numeric computed enum member value
6287-
Never = 1 << 17, // Never type
6288-
TypeParameter = 1 << 18, // Type parameter
6289-
Object = 1 << 19, // Object type
6290-
Union = 1 << 20, // Union (T | U)
6291-
Intersection = 1 << 21, // Intersection (T & U)
6292-
Index = 1 << 22, // keyof T
6293-
IndexedAccess = 1 << 23, // T[K]
6294-
Conditional = 1 << 24, // T extends U ? X : Y
6295-
Substitution = 1 << 25, // Type parameter substitution
6296-
NonPrimitive = 1 << 26, // intrinsic object type
6297-
TemplateLiteral = 1 << 27, // Template literal type
6298-
StringMapping = 1 << 28, // Uppercase/Lowercase type
6287+
NonPrimitive = 1 << 17, // intrinsic object type
6288+
Never = 1 << 18, // Never type
6289+
TypeParameter = 1 << 19, // Type parameter
6290+
Object = 1 << 20, // Object type
6291+
Index = 1 << 21, // keyof T
6292+
IndexedAccess = 1 << 22, // T[K]
6293+
Conditional = 1 << 23, // T extends U ? X : Y
6294+
Substitution = 1 << 24, // Type parameter substitution
6295+
TemplateLiteral = 1 << 25, // Template literal type
6296+
StringMapping = 1 << 26, // Uppercase/Lowercase type
6297+
Union = 1 << 27, // Union (T | U)
6298+
Intersection = 1 << 28, // Intersection (T & U)
62996299
/** @internal */
63006300
Reserved1 = 1 << 29, // Used by union/intersection type construction
63016301
/** @internal */

tests/baselines/reference/api/typescript.d.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6585,38 +6585,38 @@ declare namespace ts {
65856585
UniqueESSymbol = 16384,
65866586
EnumLiteral = 32768,
65876587
Enum = 65536,
6588-
Never = 131072,
6589-
TypeParameter = 262144,
6590-
Object = 524288,
6591-
Union = 1048576,
6592-
Intersection = 2097152,
6593-
Index = 4194304,
6594-
IndexedAccess = 8388608,
6595-
Conditional = 16777216,
6596-
Substitution = 33554432,
6597-
NonPrimitive = 67108864,
6598-
TemplateLiteral = 134217728,
6599-
StringMapping = 268435456,
6588+
NonPrimitive = 131072,
6589+
Never = 262144,
6590+
TypeParameter = 524288,
6591+
Object = 1048576,
6592+
Index = 2097152,
6593+
IndexedAccess = 4194304,
6594+
Conditional = 8388608,
6595+
Substitution = 16777216,
6596+
TemplateLiteral = 33554432,
6597+
StringMapping = 67108864,
6598+
Union = 134217728,
6599+
Intersection = 268435456,
66006600
Literal = 15360,
66016601
Unit = 97292,
66026602
Freshable = 80896,
66036603
StringOrNumberLiteral = 3072,
66046604
PossiblyFalsy = 15868,
6605-
StringLike = 402654240,
6605+
StringLike = 100664352,
66066606
NumberLike = 67648,
66076607
BigIntLike = 8320,
66086608
BooleanLike = 4352,
66096609
EnumLike = 98304,
66106610
ESSymbolLike = 16896,
66116611
VoidLike = 20,
6612-
UnionOrIntersection = 3145728,
6613-
StructuredType = 3670016,
6614-
TypeVariable = 8650752,
6615-
InstantiableNonPrimitive = 58982400,
6616-
InstantiablePrimitive = 406847488,
6617-
Instantiable = 465829888,
6618-
StructuredOrInstantiable = 469499904,
6619-
Narrowable = 536707043,
6612+
UnionOrIntersection = 402653184,
6613+
StructuredType = 403701760,
6614+
TypeVariable = 4718592,
6615+
InstantiableNonPrimitive = 29884416,
6616+
InstantiablePrimitive = 102760448,
6617+
Instantiable = 132644864,
6618+
StructuredOrInstantiable = 536346624,
6619+
Narrowable = 536575971,
66206620
}
66216621
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
66226622
interface Type {

tests/baselines/reference/conditionalTypes2.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ interface B1<T> extends A1<T> {
411411
declare function toString1(value: object | Function): string ;
412412
>toString1 : (value: object | Function) => string
413413
> : ^ ^^ ^^^^^
414-
>value : Function | object
414+
>value : object | Function
415415
> : ^^^^^^^^^^^^^^^^^
416416

417417
declare function toString2(value: Function): string ;

tests/baselines/reference/correlatedUnions.types

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,10 +1332,10 @@ function getConfigOrDefault<T extends keyof Config>(
13321332
> : ^
13331333

13341334
const assertedCheck = userValue ? userValue! : defaultValue;
1335-
>assertedCheck : NonNullable<Partial<Config>[T]>
1336-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1337-
>userValue ? userValue! : defaultValue : NonNullable<Partial<Config>[T]>
1338-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1335+
>assertedCheck : Config[T]
1336+
> : ^^^^^^^^^
1337+
>userValue ? userValue! : defaultValue : Config[T]
1338+
> : ^^^^^^^^^
13391339
>userValue : Partial<Config>[T]
13401340
> : ^^^^^^^^^^^^^^^^^^
13411341
>userValue! : NonNullable<Partial<Config>[T]>
@@ -1346,8 +1346,8 @@ function getConfigOrDefault<T extends keyof Config>(
13461346
> : ^^^^^^^^^
13471347

13481348
return assertedCheck;
1349-
>assertedCheck : NonNullable<Partial<Config>[T]>
1350-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1349+
>assertedCheck : Config[T]
1350+
> : ^^^^^^^^^
13511351
}
13521352

13531353
// repro from #47523

tests/baselines/reference/generatorYieldContextualType.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function canPickStepContinue<T extends QuickPickStep>(
274274
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
275275

276276
_selection: StepItemType<T> | Directive
277-
>_selection : Directive | StepItemType<T>
277+
>_selection : StepItemType<T> | Directive
278278
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
279279

280280
): _selection is StepItemType<T> {

tests/baselines/reference/inOperatorWithValidOperands.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
inOperatorWithValidOperands.ts(26,20): error TS2322: Type 'T' is not assignable to type 'object'.
22
inOperatorWithValidOperands.ts(30,20): error TS2322: Type 'T | U' is not assignable to type 'object'.
33
Type 'T' is not assignable to type 'object'.
4-
inOperatorWithValidOperands.ts(34,20): error TS2322: Type 'T | object' is not assignable to type 'object'.
4+
inOperatorWithValidOperands.ts(34,20): error TS2322: Type 'object | T' is not assignable to type 'object'.
55
Type 'T' is not assignable to type 'object'.
66

77

@@ -48,7 +48,7 @@ inOperatorWithValidOperands.ts(34,20): error TS2322: Type 'T | object' is not as
4848
function unionCase2<T>(t: T | object) {
4949
var rb5 = x in t;
5050
~
51-
!!! error TS2322: Type 'T | object' is not assignable to type 'object'.
51+
!!! error TS2322: Type 'object | T' is not assignable to type 'object'.
5252
!!! error TS2322: Type 'T' is not assignable to type 'object'.
5353
!!! related TS2208 inOperatorWithValidOperands.ts:33:21: This type parameter might need an `extends object` constraint.
5454
}

tests/baselines/reference/inOperatorWithValidOperands.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function unionCase<T, U>(t: T | U) {
156156
function unionCase2<T>(t: T | object) {
157157
>unionCase2 : <T>(t: T | object) => void
158158
> : ^ ^^ ^^ ^^^^^^^^^
159-
>t : T | object
159+
>t : object | T
160160
> : ^^^^^^^^^^
161161

162162
var rb5 = x in t;
@@ -166,7 +166,7 @@ function unionCase2<T>(t: T | object) {
166166
> : ^^^^^^^
167167
>x : any
168168
> : ^^^
169-
>t : T | object
169+
>t : object | T
170170
> : ^^^^^^^^^^
171171
}
172172

tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
nonPrimitiveAndTypeVariables.ts(10,9): error TS2322: Type 'T' is not assignable to type 'object'.
2-
nonPrimitiveAndTypeVariables.ts(11,9): error TS2322: Type 'T' is not assignable to type 'U | object'.
2+
nonPrimitiveAndTypeVariables.ts(11,9): error TS2322: Type 'T' is not assignable to type 'object | U'.
33

44

55
==== nonPrimitiveAndTypeVariables.ts (2 errors) ====
@@ -18,7 +18,7 @@ nonPrimitiveAndTypeVariables.ts(11,9): error TS2322: Type 'T' is not assignable
1818
!!! related TS2208 nonPrimitiveAndTypeVariables.ts:9:14: This type parameter might need an `extends object` constraint.
1919
let b: U | object = x; // Error
2020
~
21-
!!! error TS2322: Type 'T' is not assignable to type 'U | object'.
22-
!!! related TS2208 nonPrimitiveAndTypeVariables.ts:9:14: This type parameter might need an `extends U | object` constraint.
21+
!!! error TS2322: Type 'T' is not assignable to type 'object | U'.
22+
!!! related TS2208 nonPrimitiveAndTypeVariables.ts:9:14: This type parameter might need an `extends object | U` constraint.
2323
}
2424

tests/baselines/reference/nonPrimitiveAndTypeVariables.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function foo<T, U>(x: T) {
4848
> : ^
4949

5050
let b: U | object = x; // Error
51-
>b : U | object
51+
>b : object | U
5252
> : ^^^^^^^^^^
5353
>x : T
5454
> : ^

tests/baselines/reference/objectLiteralExcessProperties.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ function test<T extends IFoo>() {
237237

238238
// No excess property checks when union includes 'object' type
239239
const obj5: object | { x: string } = { z: 'abc' }
240-
>obj5 : { x: string; } | object
241-
> : ^^^^^ ^^^^^^^^^^^^
240+
>obj5 : object | { x: string; }
241+
> : ^^^^^^^^^^^^^^ ^^^
242242
>x : string
243243
> : ^^^^^^
244244
>{ z: 'abc' } : { z: string; }

tests/baselines/reference/spreadObjectOrFalsy.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ function f3<T extends undefined>(a: T) {
4343
function f4<T extends undefined>(a: object | T) {
4444
>f4 : <T extends undefined>(a: object | T) => {}
4545
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^
46-
>a : T | object
46+
>a : object | T
4747
> : ^^^^^^^^^^
4848

4949
return { ...a };
5050
>{ ...a } : {}
5151
> : ^^
52-
>a : T | object
52+
>a : object | T
5353
> : ^^^^^^^^^^
5454
}
5555

tests/baselines/reference/templateLiteralTypes3.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,21 +936,21 @@ function a<T extends {id: string}>() {
936936
> : ^^^^^^
937937

938938
let x: keyof T & string | `-${keyof T & string}`;
939-
>x : (keyof T & string) | `-${keyof T & string}`
939+
>x : `-${keyof T & string}` | (keyof T & string)
940940
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
941941

942942
x = "id";
943943
>x = "id" : "id"
944944
> : ^^^^
945-
>x : (keyof T & string) | `-${keyof T & string}`
945+
>x : `-${keyof T & string}` | (keyof T & string)
946946
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
947947
>"id" : "id"
948948
> : ^^^^
949949

950950
x = "-id";
951951
>x = "-id" : "-id"
952952
> : ^^^^^
953-
>x : (keyof T & string) | `-${keyof T & string}`
953+
>x : `-${keyof T & string}` | (keyof T & string)
954954
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
955955
>"-id" : "-id"
956956
> : ^^^^^

tests/baselines/reference/typeGuardConstructorClassAndNumber.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,15 +486,15 @@ else {
486486
function foo(instance: Function | object) {
487487
>foo : (instance: Function | object) => number
488488
> : ^ ^^ ^^^^^^^^^^^
489-
>instance : Function | object
489+
>instance : object | Function
490490
> : ^^^^^^^^^^^^^^^^^
491491

492492
if (typeof instance === 'function') {
493493
>typeof instance === 'function' : boolean
494494
> : ^^^^^^^
495495
>typeof instance : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
496496
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
497-
>instance : Function | object
497+
>instance : object | Function
498498
> : ^^^^^^^^^^^^^^^^^
499499
>'function' : "function"
500500
> : ^^^^^^^^^^

tests/baselines/reference/unionOfFunctionAndSignatureIsCallable.types

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ function f1(c1: Function, c2: () => object, callable: typeof c1 | typeof c2) {
3939
function f2(fetcherParams: object | (() => object)) {
4040
>f2 : (fetcherParams: object | (() => object)) => void
4141
> : ^ ^^ ^^^^^^^^^
42-
>fetcherParams : (() => object) | object
43-
> : ^^^^^^^ ^^^^^^^^^^
42+
>fetcherParams : object | (() => object)
43+
> : ^^^^^^^^^^^^^^^^ ^
4444

4545
const data = typeof fetcherParams === 'function'
4646
>data : error
@@ -49,8 +49,8 @@ function f2(fetcherParams: object | (() => object)) {
4949
> : ^^^^^^^
5050
>typeof fetcherParams : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"
5151
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52-
>fetcherParams : (() => object) | object
53-
> : ^^^^^^^ ^^^^^^^^^^
52+
>fetcherParams : object | (() => object)
53+
> : ^^^^^^^^^^^^^^^^ ^
5454
>'function' : "function"
5555
> : ^^^^^^^^^^
5656

tests/baselines/reference/vueLikeDataAndPropsInference2.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ declare function test<Data, Props>(fn: ThisTypedOptions<Data, Props>): void;
6565
declare function test(fn: Options): void;
6666
>test : { <Data, Props>(fn: ThisTypedOptions<Data, Props>): void; (fn: Options): void; }
6767
> : ^^^ ^^ ^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^
68-
>fn : Options<((this: Instance) => object) | object, PropsDefinition<Record<string, any>>>
69-
> : ^^^^^^^^^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68+
>fn : Options<object | ((this: Instance) => object), PropsDefinition<Record<string, any>>>
69+
> : ^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7070

7171
test({
7272
>test({ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } }}) : void

0 commit comments

Comments
 (0)