-
Notifications
You must be signed in to change notification settings - Fork 591
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
Typescript definitions support #3994
Comments
Hi Simon, happy to have this conversation! Can you shed any light on how this would handle a situation where a project-level module extends a core module like |
My thinking is that if you don't get type-checking of inherited methods, it's not accomplishing a lot. We do have long-term internal plans to try to figure out a fully effective strategy for typescript and Apostrophe but outside input could be very helpful in choosing that strategy. |
I've added the pull request with the draft code To add module definitions you just need to override the interfaces on module side (in a typescript definition file) : declare module "apostrophe" {
interface ApostropheModulesOptions {
"@apostrophecms/piece-type": {
someProperty: number
}
}
interface ApostropheModulesApi {
"@apostrophecms/piece-type": {
someMethodOnSelf(): void
}
}
} on module side you will need to add the method |
The problem to solve
When developing modules based on the self pattern we often don't see if a function really exists, where it is declared etc.
Proposed solution
Add typescript definition file at root project and
Alternatives
Additional context
I already started a POC with few definitions
The text was updated successfully, but these errors were encountered: