Skip to content
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

Expando properties with isolatedDeclarations #780

Open
exuanbo opened this issue Oct 25, 2024 · 0 comments
Open

Expando properties with isolatedDeclarations #780

exuanbo opened this issue Oct 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@exuanbo
Copy link

exuanbo commented Oct 25, 2024

export interface Type<T> {
  __brand: T;
}

export function makeType<T>(): Type<T> {
  return {} as Type<T>;
}

export function fn(): void {}

export declare namespace fn {
  export var type: Type<string>;
}

fn.type = makeType();

https://www.typescriptlang.org/play/?isolatedDeclarations=true#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgFQE8xgAefAPjgG8AoOOAfUYCMpMkATALgIG5aAX1q1QkWHHQBXJNhgIISOAFtMAa2BES5CgAoAlLy1lKNenCjAYUqEuqC4mAM4FiJigOGjw0eNNnyipJIBrwAbhAInDReYr5wnMDYADaYlnBImMrATmA4eOh25nESYWlwMG5GbqROMFDIAOYeQiKFAHSVJHAAvCrqmm4GAkA

This code has no issue with isolatedDeclarations, but is reported as slow types by JSR.

isolatedDeclarations requires manually declaring ambient namespace for the expando properties, so ideally no transformation is needed.

Affected: https://github.com/exuanbo/di-wise/blob/bd9580220a6d33bc4ca917825166713106252736/src/token.ts#L28-L34

@dsherret dsherret added the bug Something isn't working label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Needs Triage
Development

No branches or pull requests

2 participants