mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
Update weakType test + baselines
This commit is contained in:
parent
a282cbb07e
commit
068cb8d5d0
@ -1,14 +1,17 @@
|
||||
tests/cases/compiler/weakType.ts(16,13): error TS2559: Type '12' has no properties in common with type 'Settings'.
|
||||
tests/cases/compiler/weakType.ts(17,13): error TS2559: Type '"completely wrong"' has no properties in common with type 'Settings'.
|
||||
tests/cases/compiler/weakType.ts(18,13): error TS2559: Type 'false' has no properties in common with type 'Settings'.
|
||||
tests/cases/compiler/weakType.ts(35,18): error TS2559: Type '{ error?: number; }' has no properties in common with type 'ChangeOptions'.
|
||||
tests/cases/compiler/weakType.ts(60,5): error TS2322: Type '{ properties: { wrong: string; }; }' is not assignable to type 'Weak & Spoiler'.
|
||||
tests/cases/compiler/weakType.ts(15,13): error TS2559: Type '() => { timeout: number; }' has no properties in common with type 'Settings'.
|
||||
tests/cases/compiler/weakType.ts(16,13): error TS2559: Type '() => void' has no properties in common with type 'Settings'.
|
||||
tests/cases/compiler/weakType.ts(17,13): error TS2559: Type 'CtorOnly' has no properties in common with type 'Settings'.
|
||||
tests/cases/compiler/weakType.ts(18,13): error TS2559: Type '12' has no properties in common with type 'Settings'.
|
||||
tests/cases/compiler/weakType.ts(19,13): error TS2559: Type '"completely wrong"' has no properties in common with type 'Settings'.
|
||||
tests/cases/compiler/weakType.ts(20,13): error TS2559: Type 'false' has no properties in common with type 'Settings'.
|
||||
tests/cases/compiler/weakType.ts(37,18): error TS2559: Type '{ error?: number; }' has no properties in common with type 'ChangeOptions'.
|
||||
tests/cases/compiler/weakType.ts(62,5): error TS2322: Type '{ properties: { wrong: string; }; }' is not assignable to type 'Weak & Spoiler'.
|
||||
Type '{ properties: { wrong: string; }; }' is not assignable to type 'Weak'.
|
||||
Types of property 'properties' are incompatible.
|
||||
Type '{ wrong: string; }' has no properties in common with type '{ b?: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/weakType.ts (5 errors) ====
|
||||
==== tests/cases/compiler/weakType.ts (8 errors) ====
|
||||
interface Settings {
|
||||
timeout?: number;
|
||||
onError?(): void;
|
||||
@ -17,13 +20,21 @@ tests/cases/compiler/weakType.ts(60,5): error TS2322: Type '{ properties: { wron
|
||||
function getDefaultSettings() {
|
||||
return { timeout: 1000 };
|
||||
}
|
||||
interface CtorOnly {
|
||||
new(s: string): string
|
||||
}
|
||||
|
||||
function doSomething(settings: Settings) { /* ... */ }
|
||||
// forgot to call `getDefaultSettings`
|
||||
// but it is not caught because we don't check for call signatures
|
||||
doSomething(getDefaultSettings);
|
||||
// same for arrow expressions:
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2559: Type '() => { timeout: number; }' has no properties in common with type 'Settings'.
|
||||
doSomething(() => { });
|
||||
~~~~~~~~~
|
||||
!!! error TS2559: Type '() => void' has no properties in common with type 'Settings'.
|
||||
doSomething(null as CtorOnly);
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2559: Type 'CtorOnly' has no properties in common with type 'Settings'.
|
||||
doSomething(12);
|
||||
~~
|
||||
!!! error TS2559: Type '12' has no properties in common with type 'Settings'.
|
||||
@ -82,4 +93,5 @@ tests/cases/compiler/weakType.ts(60,5): error TS2322: Type '{ properties: { wron
|
||||
!!! error TS2322: Type '{ properties: { wrong: string; }; }' is not assignable to type 'Weak'.
|
||||
!!! error TS2322: Types of property 'properties' are incompatible.
|
||||
!!! error TS2322: Type '{ wrong: string; }' has no properties in common with type '{ b?: number; }'.
|
||||
|
||||
|
||||
@ -7,13 +7,15 @@ interface Settings {
|
||||
function getDefaultSettings() {
|
||||
return { timeout: 1000 };
|
||||
}
|
||||
interface CtorOnly {
|
||||
new(s: string): string
|
||||
}
|
||||
|
||||
function doSomething(settings: Settings) { /* ... */ }
|
||||
// forgot to call `getDefaultSettings`
|
||||
// but it is not caught because we don't check for call signatures
|
||||
doSomething(getDefaultSettings);
|
||||
// same for arrow expressions:
|
||||
doSomething(() => { });
|
||||
doSomething(null as CtorOnly);
|
||||
doSomething(12);
|
||||
doSomething('completely wrong');
|
||||
doSomething(false);
|
||||
@ -59,6 +61,7 @@ declare let unknown: {
|
||||
}
|
||||
}
|
||||
let weak: Weak & Spoiler = unknown
|
||||
|
||||
|
||||
|
||||
//// [weakType.js]
|
||||
@ -67,10 +70,9 @@ function getDefaultSettings() {
|
||||
}
|
||||
function doSomething(settings) { }
|
||||
// forgot to call `getDefaultSettings`
|
||||
// but it is not caught because we don't check for call signatures
|
||||
doSomething(getDefaultSettings);
|
||||
// same for arrow expressions:
|
||||
doSomething(function () { });
|
||||
doSomething(null);
|
||||
doSomething(12);
|
||||
doSomething('completely wrong');
|
||||
doSomething(false);
|
||||
|
||||
@ -6,13 +6,15 @@ interface Settings {
|
||||
function getDefaultSettings() {
|
||||
return { timeout: 1000 };
|
||||
}
|
||||
interface CtorOnly {
|
||||
new(s: string): string
|
||||
}
|
||||
|
||||
function doSomething(settings: Settings) { /* ... */ }
|
||||
// forgot to call `getDefaultSettings`
|
||||
// but it is not caught because we don't check for call signatures
|
||||
doSomething(getDefaultSettings);
|
||||
// same for arrow expressions:
|
||||
doSomething(() => { });
|
||||
doSomething(null as CtorOnly);
|
||||
doSomething(12);
|
||||
doSomething('completely wrong');
|
||||
doSomething(false);
|
||||
@ -58,3 +60,4 @@ declare let unknown: {
|
||||
}
|
||||
}
|
||||
let weak: Weak & Spoiler = unknown
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user