Skip to content

Commit

Permalink
Accept new baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed May 15, 2022
1 parent 95c3c56 commit 986963c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions tests/baselines/reference/intersectionOfUnionNarrowing.types
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ declare const q: X & AorB;

if (q.a !== undefined) {
>q.a !== undefined : boolean
>q.a : { aProp: string; } | undefined
>q.a : ({ aProp: string; } & object) | undefined
>q : X & AorB
>a : { aProp: string; } | undefined
>a : ({ aProp: string; } & object) | undefined
>undefined : undefined

q.a.aProp;
>q.a.aProp : string
>q.a : { aProp: string; }
>q.a : { aProp: string; } & object
>q : X & { a: object; b: undefined; }
>a : { aProp: string; }
>a : { aProp: string; } & object
>aProp : string

} else {
// q.b is previously incorrectly inferred as potentially undefined
q.b.bProp;
>q.b.bProp : string
>q.b : { bProp: string; }
>q.b : { bProp: string; } & object
>q : X & { a: undefined; b: object; }
>b : { bProp: string; }
>b : { bProp: string; } & object
>bProp : string
}

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(1,5): error TS2322: Type 'string' is not assignable to type 'never'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(3,5): error TS2322: Type 'number' is not assignable to type 'object'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(4,1): error TS2322: Type 'string' is not assignable to type 'never'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(8,38): error TS2322: Type '{ bar: string; }' is not assignable to type '{ err: string; }'.
Object literal may only specify known properties, and 'bar' does not exist in type '{ err: string; }'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(8,38): error TS2322: Type '{ bar: string; }' is not assignable to type 'object & { err: string; }'.
Object literal may only specify known properties, and 'bar' does not exist in type 'object & { err: string; }'.


==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts (4 errors) ====
Expand All @@ -21,6 +21,6 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(8,38
const foo: object & {} = {bar: 'bar'}; // ok
const bar: object & {err: string} = {bar: 'bar'}; // error
~~~~~~~~~~
!!! error TS2322: Type '{ bar: string; }' is not assignable to type '{ err: string; }'.
!!! error TS2322: Object literal may only specify known properties, and 'bar' does not exist in type '{ err: string; }'.
!!! error TS2322: Type '{ bar: string; }' is not assignable to type 'object & { err: string; }'.
!!! error TS2322: Object literal may only specify known properties, and 'bar' does not exist in type 'object & { err: string; }'.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const foo: object & {} = {bar: 'bar'}; // ok
>'bar' : "bar"

const bar: object & {err: string} = {bar: 'bar'}; // error
>bar : { err: string; }
>bar : object & { err: string; }
>err : string
>{bar: 'bar'} : { bar: string; }
>bar : string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(43,43): error TS2322: Type
Object literal may only specify known properties, and 'name' does not exist in type '{ prop: boolean; }'.
tests/cases/compiler/objectLiteralExcessProperties.ts(45,76): error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type '(T & { prop: boolean; }) | { name: string; }'.
Object literal may only specify known properties, and 'prop' does not exist in type '{ name: string; }'.
tests/cases/compiler/objectLiteralExcessProperties.ts(49,44): error TS2322: Type '{ z: string; }' is not assignable to type '{ x: string; }'.
Object literal may only specify known properties, and 'z' does not exist in type '{ x: string; }'.
tests/cases/compiler/objectLiteralExcessProperties.ts(49,44): error TS2322: Type '{ z: string; }' is not assignable to type 'object & { x: string; }'.
Object literal may only specify known properties, and 'z' does not exist in type 'object & { x: string; }'.


==== tests/cases/compiler/objectLiteralExcessProperties.ts (16 errors) ====
Expand Down Expand Up @@ -129,7 +129,7 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(49,44): error TS2322: Type
// The 'object' type has no effect on intersections
const obj6: object & { x: string } = { z: 'abc' }
~~~~~~~~
!!! error TS2322: Type '{ z: string; }' is not assignable to type '{ x: string; }'.
!!! error TS2322: Object literal may only specify known properties, and 'z' does not exist in type '{ x: string; }'.
!!! error TS2322: Type '{ z: string; }' is not assignable to type 'object & { x: string; }'.
!!! error TS2322: Object literal may only specify known properties, and 'z' does not exist in type 'object & { x: string; }'.
}

Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function test<T extends IFoo>() {

// The 'object' type has no effect on intersections
const obj6: object & { x: string } = { z: 'abc' }
>obj6 : { x: string; }
>obj6 : object & { x: string; }
>x : string
>{ z: 'abc' } : { z: string; }
>z : string
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/recursiveTypeRelations.types
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type ClassNameMap<S> = { [K in keyof S]?: boolean }
>ClassNameMap : ClassNameMap<S>

type ClassNameObjectMap<S> = object & ClassNameMap<S>;
>ClassNameObjectMap : ClassNameMap<S>
>ClassNameObjectMap : ClassNameObjectMap<S>

type ClassNameArg<S> = ClassName<S> | ClassNameObjectMap<S>;
>ClassNameArg : ClassNameArg<S>
Expand Down Expand Up @@ -75,7 +75,7 @@ export function css<S extends { [K in keyof S]: string }>(styles: S, ...classNam
>Object.keys : (o: object) => string[]
>Object : ObjectConstructor
>keys : (o: object) => string[]
>arg : ClassNameMap<S>
>arg : ClassNameObjectMap<S>
>reduce : { (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string; (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string; <U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U; }
>(obj: ClassNameObject, key: keyof S) => { const exportedClassName = styles[key]; obj[exportedClassName] = (arg as ClassNameMap<S>)[key]; return obj; } : (obj: ClassNameObject, key: keyof S) => ClassNameObject
>obj : ClassNameObject
Expand All @@ -95,7 +95,7 @@ export function css<S extends { [K in keyof S]: string }>(styles: S, ...classNam
>(arg as ClassNameMap<S>)[key] : boolean
>(arg as ClassNameMap<S>) : ClassNameMap<S>
>arg as ClassNameMap<S> : ClassNameMap<S>
>arg : ClassNameMap<S>
>arg : ClassNameObjectMap<S>
>key : keyof S

return obj;
Expand Down

0 comments on commit 986963c

Please sign in to comment.