Skip to content

Commit

Permalink
Upgrade typescript to 4.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Aug 26, 2022
1 parent 7397be7 commit ed67afd
Show file tree
Hide file tree
Showing 9 changed files with 11,927 additions and 4,363 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -198,7 +198,7 @@
"tree-kill": "1.2.2",
"tsec": "0.2.1",
"turbo": "1.3.2-canary.1",
"typescript": "4.6.3",
"typescript": "4.8.2",
"wait-port": "0.2.2",
"webpack": "5.74.0",
"webpack-bundle-analyzer": "4.3.0"
Expand Down
10 changes: 7 additions & 3 deletions packages/next/client/with-router.tsx
@@ -1,6 +1,10 @@
import React from 'react'
import { NextComponentType, NextPageContext } from '../shared/lib/utils'
import { NextRouter, useRouter } from './router'
import type {
BaseContext,
NextComponentType,
NextPageContext,
} from '../shared/lib/utils'
import { type NextRouter, useRouter } from './router'

export type WithRouterProps = {
router: NextRouter
Expand All @@ -13,7 +17,7 @@ export type ExcludeRouterProps<P> = Pick<

export default function withRouter<
P extends WithRouterProps,
C = NextPageContext
C extends BaseContext = NextPageContext
>(
ComposedComponent: NextComponentType<C, any, P>
): React.ComponentType<ExcludeRouterProps<P>> {
Expand Down
6 changes: 3 additions & 3 deletions packages/next/lib/typescript/writeConfigurationDefaults.ts
Expand Up @@ -58,10 +58,10 @@ function getDesiredCompilerOptions(
// All of these values work:
parsedValues: [
ts.ModuleResolutionKind.NodeJs,
ts.ModuleResolutionKind.Node12,
// only newer TypeScript versions have this field, it
// will be filtered for older ones
(ts.ModuleResolutionKind as any).Node16,
// will be filtered for new versions of TypeScript
(ts.ModuleResolutionKind as any).Node12,
ts.ModuleResolutionKind.Node16,
ts.ModuleResolutionKind.NodeNext,
].filter((val) => typeof val !== 'undefined'),
value: 'node',
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Expand Up @@ -270,7 +270,7 @@
"uuid": "8.3.2",
"vm-browserify": "1.1.2",
"watchpack": "2.4.0",
"web-vitals": "3.0.0-beta.2",
"web-vitals": "3.0.0",
"webpack": "5.74.0",
"webpack-sources1": "npm:webpack-sources@1.4.3",
"webpack-sources3": "npm:webpack-sources@3.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/server/base-http/node.ts
Expand Up @@ -15,7 +15,7 @@ type Req = IncomingMessage & {
export class NodeNextRequest extends BaseNextRequest<Readable> {
public headers = this._req.headers;

[NEXT_REQUEST_META]: RequestMeta
[NEXT_REQUEST_META]: RequestMeta = {}

get originalRequest() {
// Need to mimic these changes to the original req object for places where we use it:
Expand Down
9 changes: 5 additions & 4 deletions packages/next/shared/lib/head.tsx
Expand Up @@ -118,22 +118,23 @@ function unique() {
*
* @param headChildrenElements List of children of <Head>
*/
function reduceComponents(
function reduceComponents<T extends {} & WithInAmpMode>(
headChildrenElements: Array<React.ReactElement<any>>,
props: WithInAmpMode
props: T
) {
const { inAmpMode } = props
return headChildrenElements
.reduce(onlyReactElement, [])
.reverse()
.concat(defaultHead(props.inAmpMode).reverse())
.concat(defaultHead(inAmpMode).reverse())
.filter(unique())
.reverse()
.map((c: React.ReactElement<any>, i: number) => {
const key = c.key || i
if (
process.env.NODE_ENV !== 'development' &&
process.env.__NEXT_OPTIMIZE_FONTS &&
!props.inAmpMode
!inAmpMode
) {
if (
c.type === 'link' &&
Expand Down
4 changes: 2 additions & 2 deletions packages/next/shared/lib/side-effect.tsx
Expand Up @@ -2,8 +2,8 @@ import React, { Children, useEffect, useLayoutEffect } from 'react'

type State = JSX.Element[] | undefined

type SideEffectProps = {
reduceComponentsToState: <T>(
export type SideEffectProps = {
reduceComponentsToState: <T extends {}>(
components: Array<React.ReactElement<any>>,
props: T
) => State
Expand Down

0 comments on commit ed67afd

Please sign in to comment.