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

Update TypeScript to v5.5 #136

Merged
merged 6 commits into from
Jun 22, 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
12 changes: 12 additions & 0 deletions .changeset/swift-socks-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"create-nxjs-app": patch
"@nx.js/patch-nacp": patch
"@nx.js/constants": patch
"nxjs-runtime": patch
"@nx.js/http": patch
"@nx.js/repl": patch
"@nx.js/nro": patch
"@nx.js/nsp": patch
---

Update TypeScript to v5.5
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"wasm3.h": "c",
"poll.h": "c"
},
"C_Cpp.default.compilerPath": "/opt/devkitpro/devkitA64/bin/aarch64-none-elf-gcc"
"C_Cpp.default.compilerPath": "/opt/devkitpro/devkitA64/bin/aarch64-none-elf-gcc",
"typescript.tsdk": "node_modules/typescript/lib"
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
"@changesets/cli": "^2.27.1",
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
"turbo": "^1.12.5",
"typedoc": "^0.25.13",
"typedoc": "^0.26.0",
"typedoc-plugin-mdn-links": "^3.1.6",
"typescript": "^5.5.2",
"yauzl": "^2.10.0"
}
}
5 changes: 1 addition & 4 deletions packages/constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
"access": "public"
},
"author": "Nathan Rajlich <[email protected]>",
"license": "MIT",
"devDependencies": {
"typescript": "^5.4.5"
}
"license": "MIT"
}
3 changes: 1 addition & 2 deletions packages/create-nxjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@types/degit": "^2.8.6",
"@types/node": "^20.10.3",
"@types/which": "^3.0.3",
"types-package-json": "^2.0.39",
"typescript": "^5.4.5"
"types-package-json": "^2.0.39"
}
}
1 change: 0 additions & 1 deletion packages/http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"devDependencies": {
"nxjs-runtime": "workspace:*",
"typescript": "^5.4.5",
"vite": "^5.1.6",
"vitest": "^1.3.1"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/nro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
},
"devDependencies": {
"@types/bytes": "^3.1.4",
"@types/node": "^20.10.3",
"typescript": "^5.4.5"
"@types/node": "^20.10.3"
}
}
3 changes: 1 addition & 2 deletions packages/nsp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
},
"devDependencies": {
"@types/bytes": "^3.1.4",
"@types/node": "^20.10.3",
"typescript": "^5.4.5"
"@types/node": "^20.10.3"
}
}
3 changes: 1 addition & 2 deletions packages/patch-nacp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@tootallnate/nacp": "^0.0.1",
"@types/parse-author": "^2.0.3",
"@types/node": "^20.10.3",
"types-package-json": "^2.0.39",
"typescript": "^5.4.5"
"types-package-json": "^2.0.39"
}
}
3 changes: 1 addition & 2 deletions packages/repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"sisteransi": "^1.0.5"
},
"devDependencies": {
"nxjs-runtime": "workspace:*",
"typescript": "^5.4.5"
"nxjs-runtime": "workspace:*"
},
"keywords": [
"repl",
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"kleur": "github:TooTallNate/kleur#rgb",
"parse-css-font": "^4.0.0",
"to-px": "^1.1.0",
"typescript": "^5.4.5",
"web-streams-polyfill": "^3.2.1"
"web-streams-polyfill": "^4.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/runtime/src/font/font-face-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def(FontFaceSet);
* Contains the available fonts for use on the screen Canvas context.
* By default, `"system-ui"` is the only font available, which is the system font provided by the Switch operating system.
*
* @demo See the [fonts](../apps/fonts/) application for an example of using custom fonts.
* @demo See the `fonts` application for an example of using custom fonts.
*/
// @ts-expect-error Internal constructor
export var fonts = new FontFaceSet(INTERNAL_SYMBOL);
Expand Down
6 changes: 6 additions & 0 deletions packages/runtime/src/polyfills/abort-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export class AbortSignal extends EventTarget implements globalThis.AbortSignal {
}
return super.dispatchEvent(event);
}

// NOTE: This is new in TypeScript 5.5, however, it's supposed to be a static function.
// The TypeScript types are apparently incorrect, but we'll keep it for now to keep TS happy.
any(signals: Iterable<AbortSignal>): AbortSignal {
throw new Error('Method not implemented.');
}
}

export class AbortController implements globalThis.AbortController {
Expand Down
1 change: 0 additions & 1 deletion packages/runtime/src/polyfills/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ async function* toIterator(
yield part;
}
} else {
// @ts-expect-error TS ReadableStream does not have `Symbol.asyncIterator`
yield* part.stream();
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/polyfills/event-target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const getCbs = (t: EventTarget, type: string): Callback[] => {
*
* @see https://developer.mozilla.org/docs/Web/API/EventTarget
*/
export class EventTarget {
export class EventTarget implements globalThis.EventTarget {
/**
* Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
*
Expand Down
19 changes: 17 additions & 2 deletions packages/runtime/src/polyfills/streams.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { def } from '../utils';
import * as streams from 'web-streams-polyfill/ponyfill/es2018';
import * as streams from 'web-streams-polyfill';
import type { AbortSignal } from './abort-controller';

for (const k of Object.keys(streams)) {
Expand Down Expand Up @@ -130,6 +130,17 @@ export interface ReadableStreamGenericReader {
cancel(reason?: any): Promise<void>;
}

export interface ReadableStreamIteratorOptions {
/**
* Asynchronously iterates over the chunks in the stream's internal queue.
*
* Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader. The lock will be released if the async iterator's return() method is called, e.g. by breaking out of the loop.
*
* By default, calling the async iterator's return() method will also cancel the stream. To prevent this, use the stream's values() method, passing true for the preventCancel option.
*/
preventCancel?: boolean;
}

export interface Transformer<I = any, O = any> {
flush?: TransformerFlushCallback<O>;
readableType?: undefined;
Expand Down Expand Up @@ -229,8 +240,12 @@ export declare class ReadableStream<R = any>
): Promise<void>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
tee(): [ReadableStream<R>, ReadableStream<R>];
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/values) */
values(options?: ReadableStreamIteratorOptions): AsyncIterableIterator<any>;

[Symbol.asyncIterator](): AsyncIterableIterator<R>;
[Symbol.asyncIterator](
options?: ReadableStreamIteratorOptions,
): AsyncIterableIterator<R>;
}

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */
Expand Down
Loading