You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Do we need to use "declare" for type aliased in d.ts files? #1940
Since we already shipped type aliases this way, people have had to write declare type a bunch of times. We could break them and say "Write type, not declare type", but that would be a massive break for no real reason.
Having made that decision, it's only logical to allow declare interface as a synonym for interface for consistency's sake. There are still some places where we're slightly inconsistent, but type and interface at least should be fully aligned.
Activity
RyanCavanaugh commentedon May 4, 2015
declareshould be optional on type aliases and interfaces.declare typeanddeclare interfaceare identical totypeandinterfaceDanielRosenwasser commentedon May 4, 2015
How does this affect #2994?
yuit commentedon May 4, 2015
My understanding is that
declare typeis allowed as well asdeclare interface. So we need to stop giving an error for this casedeclare interfaceRyanCavanaugh commentedon May 5, 2015
Yui's interpretation is correct.
Since we already shipped type aliases this way, people have had to write
declare typea bunch of times. We could break them and say "Writetype, notdeclare type", but that would be a massive break for no real reason.Having made that decision, it's only logical to allow
declare interfaceas a synonym forinterfacefor consistency's sake. There are still some places where we're slightly inconsistent, buttypeandinterfaceat least should be fully aligned.