-
-
Notifications
You must be signed in to change notification settings - Fork 2k
chore: Fix TS lang server support in our .d.ts files
#4698
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
Changes from all commits
be76125
d52f11b
5169728
e0afeeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,9 @@ import { | |
| Options as PreactOptions, | ||
| Component as PreactComponent, | ||
| VNode as PreactVNode, | ||
| Context as PreactContext, | ||
| PreactContext, | ||
| HookType, | ||
| ErrorInfo, | ||
| } from '../../src/internal'; | ||
| import { Reducer, StateUpdater } from '.'; | ||
|
|
||
|
|
@@ -30,14 +32,14 @@ export interface ComponentHooks { | |
| _pendingEffects: EffectHookState[]; | ||
| } | ||
|
|
||
| export interface Component extends PreactComponent<any, any> { | ||
| export interface Component extends Omit<PreactComponent<any, any>, '_renderCallbacks'> { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR adds a healthy sprinkling of |
||
| __hooks?: ComponentHooks; | ||
| // Extend to include HookStates | ||
| _renderCallbacks?: Array<HookState | (() => void)>; | ||
| _hasScuFromHooks?: boolean; | ||
| } | ||
|
|
||
| export interface VNode extends PreactVNode { | ||
| export interface VNode extends Omit<PreactVNode, '_component'> { | ||
| _mask?: [number, number]; | ||
| _component?: Component; // Override with our specific Component type | ||
| } | ||
|
|
@@ -52,12 +54,12 @@ export type HookState = | |
|
|
||
| interface BaseHookState { | ||
| _value?: unknown; | ||
| _nextValue?: undefined; | ||
| _pendingValue?: undefined; | ||
| _args?: undefined; | ||
| _pendingArgs?: undefined; | ||
| _component?: undefined; | ||
| _cleanup?: undefined; | ||
| _nextValue?: unknown; | ||
| _pendingValue?: unknown; | ||
| _args?: unknown; | ||
| _pendingArgs?: unknown; | ||
| _component?: unknown; | ||
| _cleanup?: unknown; | ||
| } | ||
|
Comment on lines
55
to
63
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| export type Effect = () => void | Cleanup; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,9 @@ | ||
| { | ||
| "extends": "./jsconfig.json", | ||
| "include": ["src/**/*", "hooks/src/**/*"] | ||
| } | ||
| "include": [ | ||
| "src/**/*", | ||
| "hooks/src/**/*", | ||
| "compat/**/*.d.ts", | ||
| "jsx-runtime/**/*.d.ts" | ||
|
Comment on lines
+6
to
+7
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. compat & jsx-runtime source & test files throw up some errors yet but I think it's worth linting their types at least as these are user-exposed. Will help guard against typos and what not |
||
| ] | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from #4675 --
ForwardFnis not the name in React & notably it has the generics reversed. It was marked as deprecated in that PR so all this is doing is replacing it with the correct, non-deprecated version (the internals of both types match).