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

110 lines
4.6 KiB
Plaintext

tests/cases/conformance/jsdoc/validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(19,1): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/validator.ts(20,1): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
tests/cases/conformance/jsdoc/validator.ts(39,1): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/validator.ts(40,1): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsdoc/validator.ts (10 errors) ====
import "./";
import m1 = require("./mod1");
m1.thing;
m1.readonlyProp;
m1.rwAccessors;
m1.readonlyAccessor;
m1.setonlyAccessor;
// allowed assignments
m1.thing = 10;
m1.rwAccessors = 11;
m1.setonlyAccessor = "yes";
// disallowed assignments
m1.readonlyProp = "name";
~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
m1.readonlyAccessor = 12;
~~~~~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
m1.thing = "no";
~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
m1.rwAccessors = "no";
~~~~~~~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
m1.setonlyAccessor = 0;
~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
import m2 = require("./mod2");
m2.thing;
m2.readonlyProp;
m2.rwAccessors;
m2.readonlyAccessor;
m2.setonlyAccessor;
// allowed assignments
m2.thing = "ok";
m2.rwAccessors = 11;
m2.setonlyAccessor = "yes";
// disallowed assignments
m2.readonlyProp = "name";
~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
m2.readonlyAccessor = 12;
~~~~~~~~~~~~~~~~
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
m2.thing = 0;
~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
m2.rwAccessors = "no";
~~~~~~~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
m2.setonlyAccessor = 0;
~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsdoc/mod1.js (0 errors) ====
Object.defineProperty(exports, "thing", { value: 42, writable: true });
Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false });
Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } });
Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } });
Object.defineProperty(exports, "setonlyAccessor", {
/** @param {string} str */
set(str) {
this.rwAccessors = Number(str)
}
});
==== tests/cases/conformance/jsdoc/mod2.js (0 errors) ====
Object.defineProperty(module.exports, "thing", { value: "yes", writable: true });
Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false });
Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } });
Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } });
Object.defineProperty(module.exports, "setonlyAccessor", {
/** @param {string} str */
set(str) {
this.rwAccessors = Number(str)
}
});
==== tests/cases/conformance/jsdoc/index.js (0 errors) ====
/**
* @type {number}
*/
const q = require("./mod1").thing;
/**
* @type {string}
*/
const u = require("./mod2").thing;