Skip to content

Expando properties with isolatedDeclarations #780

Open
@exuanbo

Description

@exuanbo
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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions