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 transformValidatedStripTypes method #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ChALkeR
Copy link
Member

@ChALkeR ChALkeR commented Aug 1, 2024

Solves #17

It deliberately does not return anything except code, as (1) only that is ever needed in strip-only mode (2) anything else would have been unvalidated

One of the reasons why this is a new method (except for additional options overcomplicating things)

@ChALkeR ChALkeR force-pushed the chalker/transformValidatedStripTypes branch 2 times, most recently from 803a0e0 to 3645e18 Compare August 1, 2024 19:34
@ChALkeR ChALkeR marked this pull request as ready for review August 1, 2024 19:35
@ChALkeR ChALkeR force-pushed the chalker/transformValidatedStripTypes branch from 3645e18 to f7a627a Compare August 1, 2024 19:37
@ChALkeR ChALkeR changed the title add transformValidatedStripTypes method feat: add transformValidatedStripTypes method Aug 1, 2024
return true;
}

export function transformValidatedStripTypes(source: string): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep just one function transformSync, add a function called validateOptions that checks that options are valid (mode needs to be strip-only when validateResut is true)

And ad the check if validateResult do the assertion
Test the flags and add documentation

Copy link

@bcheidemann bcheidemann Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo, ideally there would be a test which asserts a throw when the new check fails. Appreciate this is not straight-forward since doesTSStripTypesResultMatchSource should never fail, but perhaps it can be exported and tested independently of transformValidatedStripTypes?

@marco-ippolito marco-ippolito added the stale PRs or issues that have been stale label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PRs or issues that have been stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants