Error ---------------------------------------------------------------------------------------- contextual_typing.js:5:11 Cannot call `handler` with `123` bound to `text` because `123` [1] is incompatible with `string` [2]. [incompatible-type] contextual_typing.js:5:11 5| handler(123); // ERROR ^^^ [1] References: contextual_typing.js:3:67 3| const handler = ((text) => text.toUpperCase()) satisfies (text: string) => string; ^^^^^^ [2] Error --------------------------------------------------------------------------------------- contextual_typing.js:26:11 Cannot call `handler` because in array element: `123` [1] is incompatible with `string` [2]. [incompatible-type] contextual_typing.js:26:11 26| handler(123); // ERROR ^^^ [1] References: contextual_typing.js:23:21 23| ...texts: Array ^^^^^^ [2] Error --------------------------------------------------------------------------------------- contextual_typing.js:35:12 Cannot get `handlers.missing` because property `missing` is missing in object literal [1]. [prop-missing] contextual_typing.js:35:12 35| handlers.missing; // ERROR: the indexer target does not add unknown keys ^^^^^^^ References: contextual_typing.js:31:20 v 31| const handlers = { 32| upper: (text) => text.toUpperCase(), 33| } satisfies {readonly [key: string]: (text: string) => string}; ^ [1] Error --------------------------------------------------------------------------------------- contextual_typing.js:65:11 Cannot call `handler` with `123` bound to `text` because `123` [1] is incompatible with `string` [2]. [incompatible-type] contextual_typing.js:65:11 65| handler(123); // ERROR ^^^ [1] References: contextual_typing.js:63:23 63| }) satisfies (text: string) => number; ^^^^^^ [2] Error --------------------------------------------------------------------------------------- contextual_typing.js:68:11 Cannot cast function to `(text: string) => string` because in the first parameter: `number` [1] is incompatible with `string` [2]. [incompatible-type] contextual_typing.js:68:11 68| ((text: number) => text.toString()) satisfies (text: string) => string; // ERROR ^^^^^^ [1] References: contextual_typing.js:68:56 68| ((text: number) => text.toString()) satisfies (text: string) => string; // ERROR ^^^^^^ [2] Error --------------------------------------------------------------------------------------- contextual_typing.js:73:19 Cannot call `text.toFixed` because property `toFixed` (did you mean `fixed`?) is missing in `String` [1]. [prop-missing] contextual_typing.js:73:19 73| ((text) => text.toFixed()) satisfies (text: string) => string; // ERROR ^^^^^^^ References: contextual_typing.js:73:47 73| ((text) => text.toFixed()) satisfies (text: string) => string; // ERROR ^^^^^^ [1] Error --------------------------------------------------------------------------------------- contextual_typing.js:74:14 Cannot cast function to `(text: string) => string` because in the return value: `number` [1] is incompatible with `string` [2]. [incompatible-type] contextual_typing.js:74:14 74| ((text) => text.length) satisfies (text: string) => string; // ERROR ^^^^^^^^^^^ References: /lib.es5.js:502:22 502| readonly length: number; ^^^^^^ [1] contextual_typing.js:74:55 74| ((text) => text.length) satisfies (text: string) => string; // ERROR ^^^^^^ [2] Error ---------------------------------------------------------------------------------------- contextual_typing.js:82:3 Cannot cast `value` to `number` because `string` [1] is incompatible with `number` [2]. [incompatible-type] contextual_typing.js:82:3 82| value as number; // ERROR ^^^^^ References: contextual_typing.js:80:34 80| const value = make() satisfies string; ^^^^^^ [1] contextual_typing.js:82:12 82| value as number; // ERROR ^^^^^^ [2] Error ---------------------------------------------------------------------------------------- contextual_typing.js:96:5 An annotation on this parameter is required because Flow cannot infer its type from local context. [missing-local-annot] 96| ((text) => text) satisfies unknown; // ERROR ^^^^ Error -------------------------------------------------------------------------------------- contextual_typing.js:104:16 Cannot assign `false` to `value.flag` because `false` [1] is incompatible with `true` [2]. [incompatible-type] contextual_typing.js:104:16 104| value.flag = false; // ERROR ^^^^^ [1] References: contextual_typing.js:101:24 101| const value = {flag: true} satisfies {readonly flag: boolean}; ^^^^ [2] Error --------------------------------------------------------------------------------------- contextual_typing.js:112:3 Cannot cast `cast(...)` to `42` because `number` [1] is incompatible with `42` [2]. [incompatible-type] contextual_typing.js:112:3 112| cast('hello') as 42; // ERROR ^^^^^^^^^^^^^ References: contextual_typing.js:110:56 110| const cast = ((text): 42 => 42) as (text: string) => number; ^^^^^^ [1] contextual_typing.js:112:20 112| cast('hello') as 42; // ERROR ^^ [2] Error ------------------------------------------------------------------------------------------------ importer.js:11:14 Cannot get `keyedNumbers.invalid` because property `invalid` is missing in object literal [1]. [prop-missing] importer.js:11:14 11| keyedNumbers.invalid; // ERROR: property `invalid` is missing ^^^^^^^ References: exporter.js:10:29 10| export const keyedNumbers = {x: 1, y: 2, z: 3} satisfies { ^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------------- satisfies.js:9:3 Cannot cast `"hello"` to `number` because `"hello"` [1] is incompatible with `number` [2]. [incompatible-type] satisfies.js:9:3 9| "hello" satisfies number; // ERROR: string is not a number ^^^^^^^ [1] References: satisfies.js:9:21 9| "hello" satisfies number; // ERROR: string is not a number ^^^^^^ [2] Error ------------------------------------------------------------------------------------------------ satisfies.js:33:5 Cannot get `o.invalid` because property `invalid` is missing in object literal [1]. [prop-missing] satisfies.js:33:5 33| o.invalid; // ERROR: property `invalid` is missing — inferred type kept the known keys ^^^^^^^ References: satisfies.js:31:13 31| const o = {x: 1, y: 2, z: 3} satisfies {readonly [key: string]: number}; ^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------------ satisfies.js:55:4 Cannot cast object literal to `{[K in Colors2]: string}` because property `blue` is missing in object literal [1] but exists in `{blue: string, green: string, red: string}` [2]. [incompatible-type] satisfies.js:55:4 v 55| ({ 56| red: "#ff0000", 57| green: "#00ff00", 58| }) satisfies {[K in Colors2]: string}; // ERROR: missing `blue` ^ [1] References: satisfies.js:58:16 58| }) satisfies {[K in Colors2]: string}; // ERROR: missing `blue` ^^^^^^^^^^^^^^^^^^^^^^^^ [2] Error ------------------------------------------------------------------------------------------------ satisfies.js:63:8 Cannot cast object literal to `{readonly x: number}` because in property `x`: `"not a number"` [1] is incompatible with `number` [2]. [incompatible-type] satisfies.js:63:8 63| ({x: "not a number"}) satisfies {readonly x: number}; // ERROR: string is not number ^^^^^^^^^^^^^^ [1] References: satisfies.js:63:48 63| ({x: "not a number"}) satisfies {readonly x: number}; // ERROR: string is not number ^^^^^^ [2] Error ----------------------------------------------------------------------------------------------- satisfies.js:115:5 Cannot get `c.debug` because property `debug` is missing in object literal [1]. [prop-missing] satisfies.js:115:5 115| c.debug; // ERROR: `debug` was never provided; satisfies doesn't add it ^^^^^ References: satisfies.js:113:13 113| const c = {name: "x"} satisfies {readonly name: string, readonly debug?: boolean}; ^^^^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------------- satisfies.js:130:4 Cannot cast object literal to `{readonly a: number}` because property `b` is extra in object literal [1] but missing in `{readonly a: number}` [2]. Exact objects do not accept extra props. [incompatible-type] satisfies.js:130:4 130| ({a: 1, b: 2}) satisfies {readonly a: number}; // ERROR: extra `b` ^^^^^^^^^^^^ [1] References: satisfies.js:130:28 130| ({a: 1, b: 2}) satisfies {readonly a: number}; // ERROR: extra `b` ^^^^^^^^^^^^^^^^^^^^ [2] Error ----------------------------------------------------------------------------------------------- satisfies.js:140:3 Cannot cast `1` to `empty` because `1` [1] is incompatible with `empty` [2]. [incompatible-type] satisfies.js:140:3 140| 1 satisfies empty; // ERROR ^ [1] References: satisfies.js:140:15 140| 1 satisfies empty; // ERROR ^^^^^ [2] Found 19 errors