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

Typescript fixes & minor cleanup #894

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

joshmeads
Copy link

@joshmeads joshmeads commented Oct 25, 2024

  • Fix spelling in example, 'aot' and 'cookie' tests
  • Remove unneeded @ts-ignore and @ts-expect-errors
  • Fix ArrayString type so that encode correctly returns string as the type. This also fixes the type errors in the tests.
  • Replace ArrayStrings Check test with Check - Cast that checks the non encoded version
  • Add to ArrayStrings Check - String test which checks the encoded version
  • Replace form unknown with string | Blob to correctly fix the types
  • Remove general commented out code, it's in git history
  • Remove forceErrorEncapsulation: true from the handle-error test as this option is no longer valid
  • In the error test check for the path in the error to narrow the type as ValidationError can return two very different types.
  • I did have to add one @ts-expect-error in the response test. Unsure why, code looks spec correct.
  • Added DOM and DOM.Iterable to the tsconfig.json. These are required for headers.keys() (DOM) and headers.getAll() (DOM.Iterable). Do note though that headers.getAll() has been removed from the spec and is deprecated. It doesn't exist in the node only types anymore.

All tests pass.

Hope this helps, I wanted to try work on a few things I've needed but had to fix a few types in the process so thought I'd submit them separately first.

🔧 (package.json): add pretest:node script to ensure build before tests
♻️ (response.test.ts): remove unnecessary ts-expect-error comments
♻️ (elysia.test.ts): remove unnecessary ts-expect-error comments
♻️ (handle-error.test.ts): remove forceErrorEncapsulation option
♻️ (modules.test.ts): remove unused eslint-disable comment
♻️ (error.test.ts): remove unused import 'error'
♻️ (utils.ts): remove unnecessary empty object in WebSocket constructor
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