mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Add test for object literal methods
This commit is contained in:
parent
22cc3a7d84
commit
9394c5ca04
@ -0,0 +1,7 @@
|
||||
tests/cases/compiler/typeCheckReturnExpressionMethodBody.ts(1,13): error TS7010: 'bar', which lacks return-type annotation, implicitly has an 'any' return type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeCheckReturnExpressionMethodBody.ts (1 errors) ====
|
||||
var foo = { bar() { return undefined } };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS7010: 'bar', which lacks return-type annotation, implicitly has an 'any' return type.
|
||||
@ -0,0 +1,5 @@
|
||||
//// [typeCheckReturnExpressionMethodBody.ts]
|
||||
var foo = { bar() { return undefined } };
|
||||
|
||||
//// [typeCheckReturnExpressionMethodBody.js]
|
||||
var foo = { bar: function () { return undefined; } };
|
||||
@ -0,0 +1,2 @@
|
||||
//@noImplicitAny: true
|
||||
var foo = { bar() { return undefined } };
|
||||
Loading…
x
Reference in New Issue
Block a user