48 lines
No EOL
4.1 KiB
Text
48 lines
No EOL
4.1 KiB
Text
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,55): error TS1005: ';' expected.
|
|
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(6,55): error TS1005: ';' expected.
|
|
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,16): error TS1131: Property or signature expected.
|
|
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,25): error TS1128: Declaration or statement expected.
|
|
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,28): error TS1005: ';' expected.
|
|
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
|
Property 'b' is missing in type '{ name: string; id: number; }'.
|
|
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'.
|
|
Types of property 'name' are incompatible.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'.
|
|
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,5): error TS2322: Type '{ name: number; id: string; }' is not assignable to type '{ name: string; id: number; }'.
|
|
Types of property 'name' are incompatible.
|
|
Type 'number' is not assignable to type 'string'.
|
|
|
|
|
|
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts (9 errors) ====
|
|
var id: number = 10000;
|
|
var name: string = "my name";
|
|
|
|
var person: { b: string; id: number } = { name, id }; // error
|
|
~~~~~~
|
|
!!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
|
!!! error TS2322: Property 'b' is missing in type '{ name: string; id: number; }'.
|
|
function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error
|
|
~
|
|
!!! error TS1005: ';' expected.
|
|
~~~~~~~~~~~~
|
|
!!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'.
|
|
!!! error TS2322: Types of property 'name' are incompatible.
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
function foo(name: string, id: number): { name: string, id: number } { return { name, id }; } // error
|
|
~
|
|
!!! error TS1005: ';' expected.
|
|
var person1: { name, id }; // error : Can't use shorthand in the type position
|
|
~~~~
|
|
!!! error TS1131: Property or signature expected.
|
|
~
|
|
!!! error TS1128: Declaration or statement expected.
|
|
~~
|
|
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'.
|
|
var person2: { name: string, id: number } = bar("hello", 5);
|
|
~
|
|
!!! error TS1005: ';' expected.
|
|
~~~~~~~
|
|
!!! error TS2322: Type '{ name: number; id: string; }' is not assignable to type '{ name: string; id: number; }'.
|
|
!!! error TS2322: Types of property 'name' are incompatible.
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'. |