-
Notifications
You must be signed in to change notification settings - Fork 12.2k
/
checkJsdocSatisfiesTag1.errors.txt
47 lines (38 loc) · 1.78 KB
/
checkJsdocSatisfiesTag1.errors.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/a.js(21,44): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T1'.
/a.js(22,17): error TS1360: Type '{}' does not satisfy the expected type 'T1'.
Property 'a' is missing in type '{}' but required in type 'T1'.
/a.js(31,49): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T4'.
==== /a.js (3 errors) ====
/**
* @typedef {Object} T1
* @property {number} a
*/
/**
* @typedef {Object} T2
* @property {"a" | "b"} a
*/
/**
* @typedef {(x: string) => string} T3
*/
/**
* @typedef {Object} T4
* @property {string} a
*/
const t1 = /** @satisfies {T1} */ ({ a: 1 });
const t2 = /** @satisfies {T1} */ ({ a: 1, b: 1 });
~
!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T1'.
const t3 = /** @satisfies {T1} */ ({});
~~~~~~~~~
!!! error TS1360: Type '{}' does not satisfy the expected type 'T1'.
!!! error TS1360: Property 'a' is missing in type '{}' but required in type 'T1'.
!!! related TS2728 /a.js:3:4: 'a' is declared here.
/** @type {T2} */
const t4 = /** @satisfies {T2} */ ({ a: "a" });
/** @type {(m: string) => string} */
const t5 = /** @satisfies {T3} */((m) => m.substring(0));
const t6 = /** @satisfies {[number, number]} */ ([1, 2]);
const t7 = /** @satisfies {T4} */ ({ a: 'test' });
const t8 = /** @satisfies {T4} */ ({ a: 'test', b: 'test' });
~
!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'T4'.