Skip to content

fix: fix typing in theme overriding #32

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

Merged
merged 1 commit into from
Jun 25, 2025

Conversation

dr-itz
Copy link
Contributor

@dr-itz dr-itz commented Jun 24, 2025

This: { [K in keyof typeof HighlightSubject]?: string }

  • gives a type with UPPER CASE keys, but the default theme and how it's resolved via TOKEN_TYPE_TO_HIGHLIGHT expects the values, i.e. lower case
  • string is wrong type as a StyleFunction is expected and then called

I.e. the types suggest this
new SqlHighlighter({ RESERVED: 'red' }) but this has no effect. To get it to work w/o this fix:
new SqlHighlighter({ reserved: c.red.bold } as any)

This: `{ [K in keyof typeof HighlightSubject]?: string } `
- gives a type with UPPER CASE keys, but the default theme and how it's
  resolved via `TOKEN_TYPE_TO_HIGHLIGHT` expects the values, i.e.
  lower case
- string is wrong type as a `StyleFunction` is expected and then called

I.e. the types suggest this
  `new SqlHighlighter({ RESERVED: 'red' })`
but this has no effect. To get it to work w/o this fix:
  `new SqlHighlighter({ reserved: c.red.bold } as any)`
@coveralls
Copy link

coveralls commented Jun 25, 2025

Pull Request Test Coverage Report for Build 15862431405

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.7%) to 94.118%

Files with Coverage Reduction New Missed Lines %
src/SqlHighlighter.ts 1 93.18%
Totals Coverage Status
Change from base Build 6624426979: -0.7%
Covered Lines: 152
Relevant Lines: 157

💛 - Coveralls

Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

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

thanks!

@B4nan B4nan merged commit 588b417 into mikro-orm:master Jun 25, 2025
4 checks passed
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.

3 participants