-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds
Description
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
declare function yargs(): void;
declare namespace yargs {
/* dozens of other things */
function default(): 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
export const "default": string;
declare namespace foo {
function "with"(): string;
}
Metadata
Metadata
Assignees
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds