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

[email protected] incompatible #3

Closed
yeliex opened this issue May 23, 2020 · 1 comment
Closed

[email protected] incompatible #3

yeliex opened this issue May 23, 2020 · 1 comment
Assignees
Labels

Comments

@yeliex
Copy link
Member

yeliex commented May 23, 2020

in [email protected], there is a type incompatible with interface declaration merge

// application.ts
class App extends Preon.Application {
    test: string
}

// typings/index.d.ts
declare module 'preon' {
    interface Context {
        app: Application
    }
}

// controller/system.ts
export default class System extends Preon.Controller {
    test(ctx: Preon.Context) {
        ctx.app.test // TS2339: Property 'test' does not exist on type 'Application'.
    }
}

Because the extended class Application is not the same as the original one

For more detail:
microsoft/TypeScript#36696
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#intersections-reduced-by-discriminant-properties

@yeliex yeliex self-assigned this May 23, 2020
@yeliex yeliex added the types label May 23, 2020
@yeliex
Copy link
Member Author

yeliex commented May 23, 2020

try interface Application instead

@yeliex yeliex closed this as completed May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant