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

Extract type information from leading comments in function declarations in Babel AST #41

Open
kungfooman opened this issue Nov 18, 2023 · 0 comments
Assignees
Labels
code generation Everything related to code generation typings Everything related to type declarations

Comments

@kungfooman
Copy link
Owner

kungfooman commented Nov 18, 2023

We have to extract type information from leading comments and then generate runtime type validations from them, since this is good JSDoc:

function add(/** @type {number} */ a, /** @type {number} */ b) {
    return a + b;
}

https://www.typescriptlang.org/play?ts=4.6.2&filetype=js#code/GYVwdgxgLglg9mABAQwCaoBQHoBUPEACUAngA4CmiA3mCALYBG5ATgL6I5YoA0iu+RMpRr0mbDlwYBKagChECxM3JQQzJMkQBqRAwDcs1rKA

@kungfooman kungfooman self-assigned this Nov 18, 2023
@kungfooman kungfooman added typings Everything related to type declarations code generation Everything related to code generation labels Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code generation Everything related to code generation typings Everything related to type declarations
Projects
None yet
Development

No branches or pull requests

1 participant