-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeSpecIssues related to the TypeScript language specificationIssues related to the TypeScript language specification
Milestone
Description
Compile the following using noImplicitAny:
function foo<T>(x: T): T { return x }
interface I {
x: string;
}
var i: I = foo({ x: null }); // Error
var s: string = f(null); // No error
Neither of these should be errors. According to the spec, both of these should widen, but in #531 @DanielRosenwasser and I explain why these should not widen.
The noImplicitAny error resulting from widening is a breaking change from 1.0, and it broke a customer.
Metadata
Metadata
Assignees
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeSpecIssues related to the TypeScript language specificationIssues related to the TypeScript language specification