Skip to content

Commit bf7a195

Browse files
authored
types: Correct outdated imports in jsx-runtime (#4981)
* fix: Type errors in jsx-runtime * chore: Disable non-functional linting * revert: Bring back linting * chore: Adjust linting setup * revert: Continue re-exporting JSX namespace from `jsx-runtime`
1 parent 5a02923 commit bf7a195

File tree

5 files changed

+27
-68
lines changed

5 files changed

+27
-68
lines changed

compat/server.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// @ts-nocheck TS loses its mind over the mixed module systems here.
2+
// It's not ideal, but works at runtime and we're not shipping mixed type definitions.
3+
14
import { renderToString } from 'preact-render-to-string';
25
import { renderToPipeableStream } from 'preact-render-to-string/stream-node';
36
import { renderToReadableStream } from 'preact-render-to-string/stream';

jsconfig-lint.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"extends": "./jsconfig.json",
33
"compilerOptions": {
4-
"skipLibCheck": true,
5-
"noEmit": true,
6-
"typeRoots": ["./node_modules/@types", "./node_modules", "./types"]
4+
// More modern settings as Vite & Vitest require them and TS doesn't allow
5+
// silencing errors from `node_modules` alone.
6+
"moduleResolution": "Node16",
7+
"target": "ES2015",
8+
"module": "Node16",
9+
"checkJs": false
710
},
811
"include": [
912
"src/**/*",

jsx-runtime/src/index.d.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ import {
66
ComponentChild,
77
ComponentChildren,
88
VNode,
9-
Attributes
9+
Attributes,
10+
HTMLAttributes,
11+
SVGAttributes
1012
} from 'preact';
1113
import { JSXInternal } from '../../src/jsx';
1214

1315
export function jsx(
1416
type: string,
15-
props: JSXInternal.HTMLAttributes &
16-
JSXInternal.SVGAttributes &
17+
props: HTMLAttributes &
18+
SVGAttributes &
1719
Record<string, any> & { children?: ComponentChild },
1820
key?: string
1921
): VNode<any>;
@@ -25,8 +27,8 @@ export function jsx<P>(
2527

2628
export function jsxs(
2729
type: string,
28-
props: JSXInternal.HTMLAttributes &
29-
JSXInternal.SVGAttributes &
30+
props: HTMLAttributes &
31+
SVGAttributes &
3032
Record<string, any> & { children?: ComponentChild[] },
3133
key?: string
3234
): VNode<any>;
@@ -38,8 +40,8 @@ export function jsxs<P>(
3840

3941
export function jsxDEV(
4042
type: string,
41-
props: JSXInternal.HTMLAttributes &
42-
JSXInternal.SVGAttributes &
43+
props: HTMLAttributes &
44+
SVGAttributes &
4345
Record<string, any> & { children?: ComponentChildren },
4446
key?: string
4547
): VNode<any>;

types/events.d.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

types/weak-key.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
declare global {
2+
export interface WeakKeyTypes {
3+
object: object;
4+
}
5+
6+
export type WeakKey = WeakKeyTypes[keyof WeakKeyTypes];
7+
}
8+
9+
export {};

0 commit comments

Comments
 (0)