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

Remove patched dom types (v6.x branch) #3531

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"@fastify/busboy": "2.1.1",
"@matteo.collina/tspl": "^0.1.1",
"@sinonjs/fake-timers": "^11.1.0",
"@types/node": "^18.0.3",
"@types/node": "~18.17.19",
Copy link
Member

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

@eXhumer eXhumer Sep 1, 2024

Choose a reason for hiding this comment

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

This just provides type for node 18.17 specifically, which is the minimum required based on the engines version. The listed version ^18.0.3 doesn't contain the Event and EventTarget. And the version that ends up being installed installs typing related to node 18.19 (18.19.47) instead of the minimum supported 18.17

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can revert back this change if necessary, but I strongly recommend locking the @types/node to the minimum supported version mentioned in engines.node in package.json.

"abort-controller": "^3.0.0",
"borp": "^0.15.0",
"c8": "^10.0.0",
Expand Down
2 changes: 0 additions & 2 deletions types/eventsource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { MessageEvent, ErrorEvent } from './websocket'
import Dispatcher from './dispatcher'

import {
EventTarget,
Event,
EventListenerOptions,
AddEventListenerOptions,
EventListenerOrEventListenerObject
Expand Down
2 changes: 1 addition & 1 deletion types/filereader.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="node" />

import { Blob } from 'buffer'
import { DOMException, Event, EventInit, EventTarget } from './patch'
import { DOMException, EventInit } from './patch'

export declare class FileReader {
__proto__: EventTarget & FileReader
Expand Down
38 changes: 0 additions & 38 deletions types/patch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,6 @@ export type DOMException = typeof globalThis extends { DOMException: infer T }
? T
: any

export type EventTarget = typeof globalThis extends { EventTarget: infer T }
? T
: {
addEventListener(
type: string,
listener: any,
options?: any,
): void
dispatchEvent(event: Event): boolean
removeEventListener(
type: string,
listener: any,
options?: any | boolean,
): void
}

export type Event = typeof globalThis extends { Event: infer T }
? T
: {
readonly bubbles: boolean
cancelBubble: () => void
readonly cancelable: boolean
readonly composed: boolean
composedPath(): [EventTarget?]
readonly currentTarget: EventTarget | null
readonly defaultPrevented: boolean
readonly eventPhase: 0 | 2
readonly isTrusted: boolean
preventDefault(): void
returnValue: boolean
readonly srcElement: EventTarget | null
stopImmediatePropagation(): void
stopPropagation(): void
readonly target: EventTarget | null
readonly timeStamp: number
readonly type: string
}

export interface EventInit {
bubbles?: boolean
cancelable?: boolean
Expand Down
2 changes: 0 additions & 2 deletions types/websocket.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import type { Blob } from 'buffer'
import type { MessagePort } from 'worker_threads'
import {
EventTarget,
Event,
EventInit,
EventListenerOptions,
AddEventListenerOptions,
Expand Down
Loading