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

feat: add TS type declarations #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ImRodry
Copy link

@ImRodry ImRodry commented Nov 1, 2022

This PR adds built-in TS type definitions taken from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/safe-regex (aka npmjs.com/package/@types/safe-regex)

Note for the future and for maintainability: these types only need to be changed if:

  • A new export is added to the package (either a function, object, etc)
  • A new parameter is added to the function
  • A new option is added to the options interface

In order to update the options, simply add a new line after the existing one and type the name of the option followed by its type. You can see TS's most basic types here: https://www.w3schools.com/typescript/typescript_simple_types.php

If adding a new export that isn't the default export, simply declare it with the export keyword before it. Be sure to give it the same name it has in the code!

@ImRodry
Copy link
Author

ImRodry commented Nov 1, 2022

This PR supersedes #29 as it was outdated and had merge conflicts

@ImRodry ImRodry mentioned this pull request Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant