-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow .d.ts files to represent anonymous class expressions with private
members
#36060
Comments
private
members
Wouldn't it be cool if this had some text in it? |
It doesn't need, the other issue has details, but it is closed. I just think that this is a valid problem that is faced much too often by TS devs. |
Related to #17293 (actually the same) - see #17293 (comment) Related to #17744 - see my comment explaining why this is important #17744 (comment) |
any process? Encountered this issue when trying Builder Pattern. |
This seems like it would be a way to annotate classes that have computed properties when using isolated declarations. Right now the only way to type this export class Foo implements Iterable<number> {
[Symbol.iterator]: () => {
// ^ Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.ts(9038)
...
}
} is to do something like interface FooInstance extends Iterable<number> {}
interface FooClass {
constructor(): FooInstance;
}
const _Foo = class {
[Symbol.iterator]: () => {
...
}
};
export const Foo: FooClass = _Foo;
export type Foo = FooInstance; which is pretty verbose and doesn't quite have the exact same semantics in some cases. If anonymous class types were allowed then we could perhaps do something like export const Foo: class implements Iterable<number> {} = class {
[Symbol.iterator]: () => {
...
}
} |
Re-opening of #30355
That other issue is labeled "working as intended" so instead of this feature being a bug report, it is a feature request.
The text was updated successfully, but these errors were encountered: