Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
devjiwonchoi committed Nov 5, 2024
1 parent 7a41ae8 commit a86017d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
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 || ''
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

0 comments on commit a86017d

Please sign in to comment.