Support symbol properties on namespaces
See original GitHub issueSearch Terms
- namespace symbol
- namespace symbol property
- namespace symbol properties
Suggestion
The ability to declare symbol properties on TypeScript namespaces.
Use Cases
See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/42154#discussion_r376739320.
Examples
// doSomething.d.ts
import { promisify } from "util";
declare function doSomething(
foo: any,
onSuccessCallback: (result: string) => void,
onErrorCallback: (reason: any) => void
);
declare namespace doSomething {
function [promisify.custom](foo: any): Promise<string>;
}
export = doSomething;
Checklist
My suggestion meets these guidelines:
- This wouldn’t be a breaking change in existing TypeScript/JavaScript code
- This wouldn’t change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript’s Design Goals.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Namespaces - cppreference.com
Symbols declared inside a namespace block are placed in a named scope that prevents them from being mistaken for identically-named symbols ...
Read more >IPropertySymbol Interface (Microsoft.CodeAnalysis)
Properties ; ContainingNamespace. Gets the INamespaceSymbol for the nearest enclosing namespace. Returns null if the symbol isn't contained in a namespace. ( ...
Read more >Symbol - JavaScript - MDN Web Docs
Chrome Edge
Symbol Full support. Chrome38. Toggle history Full support. Edge12. footnote...
@@toPrimitive Full support. Chrome47. Toggle history Full support. Edge15. Toggle...
Symbol() constructor Full support....
Read more >Symbol Class Properties
ControlTemplate, Gets or sets the control template used for this symbol. public Property, DependencyObjectType, (Inherited from System.Windows.
Read more >Compiler error "cannot resolve symbol" with nested ...
BasicFolders.Properties { using System;. without the nasty duplicate. It's still an open question on how this happened.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems like this is mostly meant for the
.d.ts
representations - is that the intent? Because otherwise, you can already add computed properties to functions.One problem that @weswigham brought up with this is that assuming you’re repurposing
let
/const
/var
to export these symbols, it would introduce a parsing ambiguity.😦