TypeScript/tests/baselines/reference/checkJsdocTypeTag2.errors.txt

49 lines
2.1 KiB
Plaintext

tests/cases/conformance/jsdoc/0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/0.js(8,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type.
tests/cases/conformance/jsdoc/0.js(10,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
tests/cases/conformance/jsdoc/0.js(17,1): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(20,21): error TS2339: Property 'concat' does not exist on type 'number'.
tests/cases/conformance/jsdoc/0.js(24,19): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsdoc/0.js (7 errors) ====
// @ts-check
/** @type {String} */
var S = true;
~
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
/** @type {number} */
var n = "hello";
~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
/** @type {function (number)} */
~~~~~~~~~~~~~~~~~
!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type.
const x1 = (a) => a + 1;
x1("string");
~~~~~~~~
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
/** @type {function (number): number} */
const x2 = (a) => a + 1;
/** @type {string} */
var a;
a = x2(0);
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
/** @type {function (number): number} */
const x3 = (a) => a.concat("hi");
~~~~~~
!!! error TS2339: Property 'concat' does not exist on type 'number'.
x3(0);
/** @type {function (number): string} */
const x4 = (a) => a + 1;
~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
x4(0);