mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge pull request #5736 from UBC-CPEN/issue-5173
Give more helpful error when trying to set default values on an interface.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/errorOnInitializerInInterfaceProperty.ts(2,19): error TS1246: An interface property cannot have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/compiler/errorOnInitializerInInterfaceProperty.ts (1 errors) ====
|
||||
interface Foo {
|
||||
bar: number = 5;
|
||||
~
|
||||
!!! error TS1246: An interface property cannot have an initializer.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [errorOnInitializerInInterfaceProperty.ts]
|
||||
interface Foo {
|
||||
bar: number = 5;
|
||||
}
|
||||
|
||||
|
||||
//// [errorOnInitializerInInterfaceProperty.js]
|
||||
@@ -0,0 +1,17 @@
|
||||
tests/cases/compiler/errorOnInitializerInObjectTypeLiteralProperty.ts(2,19): error TS1247: A type literal property cannot have an initializer.
|
||||
tests/cases/compiler/errorOnInitializerInObjectTypeLiteralProperty.ts(6,19): error TS1247: A type literal property cannot have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/compiler/errorOnInitializerInObjectTypeLiteralProperty.ts (2 errors) ====
|
||||
var Foo: {
|
||||
bar: number = 5;
|
||||
~
|
||||
!!! error TS1247: A type literal property cannot have an initializer.
|
||||
};
|
||||
|
||||
let Bar: {
|
||||
bar: number = 5;
|
||||
~
|
||||
!!! error TS1247: A type literal property cannot have an initializer.
|
||||
};
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [errorOnInitializerInObjectTypeLiteralProperty.ts]
|
||||
var Foo: {
|
||||
bar: number = 5;
|
||||
};
|
||||
|
||||
let Bar: {
|
||||
bar: number = 5;
|
||||
};
|
||||
|
||||
|
||||
//// [errorOnInitializerInObjectTypeLiteralProperty.js]
|
||||
var Foo;
|
||||
var Bar;
|
||||
@@ -0,0 +1,3 @@
|
||||
interface Foo {
|
||||
bar: number = 5;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
var Foo: {
|
||||
bar: number = 5;
|
||||
};
|
||||
|
||||
let Bar: {
|
||||
bar: number = 5;
|
||||
};
|
||||
Reference in New Issue
Block a user