fix: escape keys in generated types by Morgbn · Pull Request #143 · unjs/untyped · GitHub
Skip to content

fix: escape keys in generated types#143

Merged
pi0 merged 4 commits into
unjs:mainfrom
Morgbn:main
Dec 16, 2024
Merged

fix: escape keys in generated types#143
pi0 merged 4 commits into
unjs:mainfrom
Morgbn:main

Conversation

@Morgbn

@Morgbn Morgbn commented Oct 21, 2024

Copy link
Copy Markdown
Contributor

escapeKey function was not checking for valid property names. For example, { "2ndKey" : "…" } was returning 2ndKey: string causing ts errors.
I originally encountered this error opening .nuxt/types/schema.d.ts containing tailwind config with 2xl, 3xl...
image
Hope this pull request help.

@Morgbn

Morgbn commented Dec 16, 2024

Copy link
Copy Markdown
Contributor Author

@pi0 pi0 changed the title fix: escapeKey regex check valid property names fix: generate valid types for keys need escaping Dec 16, 2024

@pi0 pi0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for PR and tests ❤️

I've refactored to use knitwork utils which is little bit safer

@pi0 pi0 changed the title fix: generate valid types for keys need escaping fix: escape keys in generated types Dec 16, 2024
@pi0 pi0 merged commit 776c59d into unjs:main Dec 16, 2024
@codecov

codecov Bot commented Dec 16, 2024

Copy link
Copy Markdown

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.

2 participants