0.2.0 • Published 2 years ago
@celeranis/node-current-types v0.2.0
Node.js 18.x Type Definitions
For the impatient people using newer versions of Node.js currently unsupported by DefinitelyTyped (me)
Features
This library extends and depends on existing definitions from @types/node
.
Added globals
- WHATWG fetch standard (via undici)
- Functions:
fetch
- Classes:Request
,Response
,Headers
,FormData
,Blob
^1 - Types:RequestInit
,BodyInit
,HeadersInit
,RequestInfo
,BodyMixin
,ResponseInit
- WHATWG
DOMException
- WHATWG Events
- Classes:
Event
,EventTarget
- Interfaces:EventInit
,EventListenerOptions
,AddEventListenerOptions
,EventListener
,EventListenerObject
,EventListenerOrEventListenerObject
- WHATWG Messaging (via worker_threads)
- Classes:
MessageEvent
,MessagePort
,MessageChannel
,BroadcastChannel
- Interfaces:MessageEventInit
- WHATWG Streams standard (via stream/web)
- Classes:
-
ReadableStream
,ReadableStreamDefaultController
,ReadableStreamDefaultReader
,ReadableByteStreamController
,ReadableStreamBYOBReader
,ReadableStreamBYOBRequest
-WritableStream
,WritableStreamDefaultController
,WritableStreamDefaultWriter
-TransformStream
,TransformStreamDefaultController
-CompressionStream
,DecompressionStream
-ByteLengthQueuingStrategy
- Interfaces:ReadableStreamDefaultReadDoneResult
,ReadableStreamDefaultReadValueResult
,ReadableStreamDefaultReadResult
- WHATWG Encoding standard (via util)
- Classes:
TextEncoder
,TextEncoderStream
,TextDecoder
,TextDecoderStream
performance
(via perf_hooks)- Added
Array.findLast()
andArray.findLastIndex()
, which are currently missing from TypeScript'slib.esnext.d.ts
Module extensions
- Modified:
worker_threads
- UpdatedMessagePort
andBroadcastChannel
to correctly extendEventTarget
- Modified:
process
- Addedprocess.getActiveResourcesInfo()
- Addedprocess.setSourceMapsEnabled()
Installation
# with npm
npm install --save-dev @celeranis/node-current-types
# with yarn
yarn add --dev @celeranis/node-current-types
# with pnpm
pnpm add --save-dev @celeranis/node-current-types
Usage
After installation, add this to your project's tsconfig.json
and/or jsconfig.json
's compilerOptions
:
"types": ["@celeranis/node-current-types"]