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

Source-loader: Fix invalid call to CSF sanitize #18930

Merged
merged 5 commits into from
Sep 26, 2022

Conversation

zhyd1997
Copy link
Contributor

@zhyd1997 zhyd1997 commented Aug 14, 2022

Issue: #12208

What I did

The error was reported by sanitize function, its parameter only accepts the string type:
https://github.com/ComponentDriven/csf/blob/5654bca6cd222684b0128ee4835258d990d3b526/src/index.ts#L8

We import it to ts file in development mode but use it in js file in production mode, so it misses the type restrict.

Here I add an additional type restrict in js style, which uses typeof to determine if its parameter is a string type.

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

If your answer is yes to any of these, please make sure to include it in your PR.

@shilman shilman changed the title fix: handled external 'add' method. Source-loader: Fix invalid call to CSF sanitize Aug 18, 2022
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Thanks so much for your contribution! Would love to get this tested, etc, but in the interest of expediency I'm merging as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants