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

Bump TypeScript to 5.6.3 #72311

Merged
merged 6 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"@types/html-validator": "5.0.3",
"@types/http-proxy": "1.17.3",
"@types/jest": "29.5.5",
"@types/node": "20.12.3",
"@types/node": "20.17.6",
"@types/node-fetch": "2.6.1",
"@types/react": "npm:types-react@19.0.0-rc.0",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
Expand Down Expand Up @@ -246,7 +246,7 @@
"tree-kill": "1.2.2",
"tsec": "0.2.1",
"turbo": "2.1.2",
"typescript": "5.5.3",
"typescript": "5.6.3",
"unfetch": "4.2.0",
"wait-port": "0.2.2",
"webpack": "5.95.0",
Expand All @@ -265,7 +265,7 @@
"webpack": "5.95.0",
"browserslist": "4.22.2",
"caniuse-lite": "1.0.30001579",
"@types/node": "20.12.3",
"@types/node": "20.17.6",
"@babel/core": "7.22.5",
"@babel/parser": "7.22.5",
"@babel/types": "7.22.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
"text-table": "0.2.0",
"timers-browserify": "2.0.12",
"tty-browserify": "0.0.1",
"typescript": "5.5.3",
"typescript": "5.6.3",
"ua-parser-js": "1.0.35",
"unistore": "3.4.1",
"util": "0.12.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/lib/lru-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class LRUCache<T> {
}

private evictLeastRecentlyUsed(): void {
const lruKey = this.cache.keys().next().value
const lruKey = this.cache.keys().next().value || ''
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure this would be correct? Isn't this just TypeScript being annoying that you can't check for existence in a collection because they types aren't compareable?

For example,

const collection = ['foo']
// number is not assignable to string but it's fine that it just returns false
collection.includes(5)

Guarding the whole block in a typecheck is safer to not introduce runtime changes just because types were updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

It was a string | undefined cannot be passed to param value string error, but your suggestion makes sense.

const lruSize = this.sizes.get(lruKey) || 0
this.totalSize -= lruSize
this.cache.delete(lruKey)
Expand Down
4 changes: 4 additions & 0 deletions packages/next/src/server/lib/mock-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ export class MockedResponse extends Stream.Writable implements ServerResponse {
public addTrailers(): void {
throw new Error('Method not implemented.')
}

public setHeaders(): this {
throw new Error('Method not implemented.')
}
}

interface RequestResponseMockerOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class HeadersAdapter extends Headers {
}
}

public *entries(): IterableIterator<[string, string]> {
public *entries(): HeadersIterator<[string, string]> {
for (const key of Object.keys(this.headers)) {
const name = key.toLowerCase()
// We assert here that this is a string because we got it from the
Expand All @@ -208,14 +208,14 @@ export class HeadersAdapter extends Headers {
}
}

public *keys(): IterableIterator<string> {
public *keys(): HeadersIterator<string> {
for (const key of Object.keys(this.headers)) {
const name = key.toLowerCase()
yield name
}
}

public *values(): IterableIterator<string> {
public *values(): HeadersIterator<string> {
for (const key of Object.keys(this.headers)) {
// We assert here that this is a string because we got it from the
// Object.keys() call above.
Expand All @@ -225,7 +225,7 @@ export class HeadersAdapter extends Headers {
}
}

public [Symbol.iterator](): IterableIterator<[string, string]> {
public [Symbol.iterator](): HeadersIterator<[string, string]> {
return this.entries()
}
}
8 changes: 4 additions & 4 deletions packages/next/types/$$compiled.internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ declare module 'next/dist/compiled/amphtml-validator' {
}

declare module 'next/dist/compiled/superstruct' {
import m from 'superstruct'
import * as m from 'superstruct'
export = m
}
declare module 'next/dist/compiled/async-retry'
Expand Down Expand Up @@ -544,7 +544,7 @@ declare module 'next/dist/compiled/picomatch' {
export = m
}
declare module 'next/dist/compiled/nanoid/index.cjs' {
import m from 'nanoid'
import * as m from 'nanoid'
export = m
}
declare module 'next/dist/compiled/ora' {
Expand Down Expand Up @@ -590,7 +590,7 @@ declare module 'next/dist/compiled/tar' {
}

declare module 'next/dist/compiled/terser' {
import m from 'terser'
import * as m from 'terser'
export = m
}
declare module 'next/dist/compiled/semver' {
Expand Down Expand Up @@ -619,7 +619,7 @@ declare module 'next/dist/compiled/unistore' {
export = m
}
declare module 'next/dist/compiled/web-vitals' {
import m from 'web-vitals'
import * as m from 'web-vitals'
export = m
}
declare module 'next/dist/compiled/web-vitals-attribution' {}
Expand Down
Loading
Loading