-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Bug Report
π Search Terms
Array
covariance hardcoded?, Array
invariance, --noLib
π Version & Regression Information
Tested with 4.9.5
β― Playground Link
π» Code
// @noLib: true
interface Array<T>
{ [i: number]: T | undefined
, push: (t: T) => number
}
interface _Array<T>
{ [i: number]: T | undefined
, push: (t: T) => number
}
declare let as: Array<"a">
declare let abs: Array<"a" | "b">
abs = as
declare let _as: _Array<"a">
declare let _abs: _Array<"a" | "b">
_abs = _as
π Actual behavior
The assignment abs = as
compiles.
π Expected behavior
The assignment abs = as
should not compile, just like the assignment _abs = _as
does not compile.
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript