TypeScript/tests/baselines/reference/newOperator.errors.txt
2014-12-16 19:11:07 -08:00

88 lines
3.4 KiB
Plaintext

tests/cases/compiler/newOperator.ts(3,13): error TS2304: Cannot find name 'ifc'.
tests/cases/compiler/newOperator.ts(10,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/newOperator.ts(11,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/newOperator.ts(12,5): error TS2304: Cannot find name 'string'.
tests/cases/compiler/newOperator.ts(18,14): error TS2304: Cannot find name 'string'.
tests/cases/compiler/newOperator.ts(18,20): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.
tests/cases/compiler/newOperator.ts(21,1): error TS2304: Cannot find name 'string'.
tests/cases/compiler/newOperator.ts(22,1): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.
tests/cases/compiler/newOperator.ts(28,13): error TS2304: Cannot find name 'q'.
tests/cases/compiler/newOperator.ts(31,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/newOperator.ts(44,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/newOperator.ts(45,23): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.
==== tests/cases/compiler/newOperator.ts (12 errors) ====
interface ifc { }
// Attempting to 'new' an interface yields poor error
var i = new ifc();
~~~
!!! error TS2304: Cannot find name 'ifc'.
// Parens are optional
var x = new Date;
var y = new Date();
// Target is not a class or var, good error
var t1 = new 53();
~~~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
var t2 = new ''();
~~~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
new string;
~~~~~~
!!! error TS2304: Cannot find name 'string'.
// Use in LHS of expression?
(new Date()).toString();
// Various spacing
var t3 = new string[]( );
~~~~~~
!!! error TS2304: Cannot find name 'string'.
~~
!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.
var t4 =
new
string
~~~~~~
!!! error TS2304: Cannot find name 'string'.
[
~
]
~~~~~
!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.
(
);
// Unresolved symbol
var f = new q();
~
!!! error TS2304: Cannot find name 'q'.
// not legal
var t5 = new new Date;
~~~~~~~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
// Can be an expression
new String;
module M {
export class T {
x: number;
}
}
class S {
public get xs(): M.T[] {
~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return new M.T[];
~~
!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.
}
}