fix(types): fix TypeScript types #58
- RE
This only includes the TypeScript type fixes from #57.
---
CommonJS
```jsonc tsconfig.json { "compilerOptions": { "checkJs": true } } ```
Before ```js // ✗ TypeError require('clsx')('')
// ✔️ Ok require('clsx').clsx('')
// ✗ Runtime error require('clsx').default('') ```
After ```js // ✔️ Ok require('clsx')('')
// ✔️ Ok require('clsx').clsx('')
// ✔️ Runtime and type error require('clsx').default('') ```
---
```jsonc // tsconfig.json { "compilerOptions": { "module": "node16" } } ```
Before ```js import clsx from 'clsx' // ✗ TypeError clsx('') // ✗ TypeError clsx.clsx('') // ✗ Runtime error clsx.default('')
// ✗ TypeError import { clsx } from 'clsx' ```
After ```js import clsx from 'clsx' // ✔️ Ok clsx('') // ✔️ Ok clsx.clsx('') // ✔️ Runtime error and type error clsx.default('')
// ✗ TypeError import { clsx } from 'clsx' ```
---
```jsonc // tsconfig.json { "compilerOptions": { "esModuleInterop": true } } ```
Before ```js import clsx from 'clsx' // ✔️ Ok clsx('') // ✗ TypeError clsx.clsx('') // ✔️ Type error and runtime error clsx.default('')
// ✔️ Ok import { clsx } from 'clsx' ```
After ```js import clsx from 'clsx' // ✔️ Ok clsx('') // ✔️ Ok clsx.clsx('') // ✔️ Type error and runtime error clsx.default('')
// ✔️ Ok import { clsx } from 'clsx' ```
- LU
Superseded by #57. Thank you
remcohaszinghead-ref-deleted3 years ago on GitHub