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

Fix generated TypeScript type definitions #32

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

sleelin
Copy link
Collaborator

@sleelin sleelin commented Dec 16, 2024

Currently during build, to generate TypeScript type definitions, the packager directly calls the TypeScript compiler using the JavaScript source files as root files. The generated type definitions are then manually stripped of excess irrelevant declarations, and merged with a minimally preauthored type definition file. Whilst this process removes inaccessible types, it is still prone to errors, and does not properly translate JSDoc type annotations into actual type declarations.

This change modifies the build process so that type definitions are generated using the ostensibly-typed package, added as a devDependency, which produces a clean type definition file incorporating type definitions for JSDoc type annotations. Additionally, it automatically detects JavaScript classes that extend types/interfaces that TypeScript considers to not be "constructable", and adds an extra interface declaration extending the type/interface instead (fixes #24).

@sleelin sleelin linked an issue Dec 16, 2024 that may be closed by this pull request
@sleelin sleelin self-assigned this Dec 16, 2024
@sleelin sleelin added the bug Something isn't working label Dec 16, 2024
@sleelin sleelin added this to the 1.3.1 milestone Dec 16, 2024
@sleelin sleelin merged commit 95bfdaa into main Dec 16, 2024
@sleelin sleelin deleted the issue/24-typescript-definitions branch December 16, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

TypeScript: SCIMMYRouters does not extend express.Router
1 participant