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
The node module yargs is callable (typeof require('yargs') === 'function'). It also has a property named default that is a function.
This makes writing a definition file very difficult. You'd be inclined to write
declarefunctionyargs(): void;declarenamespaceyargs{/* dozens of other things */functiondefault(): void;// syntax error}export=yargs;
There's not an obvious workaround that doesn't have bad side effects (e.g. rewriting the whole mess as a var doesn't really work in the case where there's a nested class), possibly requiring a massive restructuring of the entire file.
Wherever an identifier appears in an ambient context where it could have been initialized as a property, it should be allowed to be quoted. For example
Activity
RyanCavanaugh commentedon Aug 9, 2016
This actually prevents some objects from being correctly represented. Consider if you had some object
foothat was legal to use asRyanCavanaugh commentedon Jul 14, 2017
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/17985/files#diff-ca41bc5f580b39365289711693a2ac6cR19
BendingBender commentedon Jul 22, 2017
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/18309/files#diff-c892b71507d5d1f0e96637ae3684df9eR60
RyanCavanaugh commentedon Nov 29, 2017
DefinitelyTyped/DefinitelyTyped#21749
mhegazy commentedon Nov 29, 2017
Note that
export { x as y}is legal in anamespacein an ambient context. so the issue in the OP can be written as: