Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit cab9fd9

Browse files
authored
chore(deps): upgrade typescript to 3.2 (#1203)
TypeScript 3.2 has better support for generic-typed object spreads, which helped in another commit. Compile errors were due to: - microsoft/TypeScript#28768
1 parent 56cfdcd commit cab9fd9

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
"url": "/schema/site.schema.json"
1616
}
1717
],
18-
"editor.formatOnSave": true
18+
"editor.formatOnSave": true,
19+
"typescript.tsdk": "node_modules/typescript/lib"
1920
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"tslint": "^5.11.0",
171171
"tslint-language-service": "^0.9.9",
172172
"typedoc": "^0.13.0",
173-
"typescript": "^3.1.6",
173+
"typescript": "^3.2.1",
174174
"uglifyjs-webpack-plugin": "^1.2.4",
175175
"utc-version": "^1.1.0",
176176
"webpack": "^4.23.1",

web/src/auth/withAuthenticatedUser.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@ import React from 'react'
22
import { Redirect } from 'react-router'
33
import * as GQL from '../../../shared/src/graphql/schema'
44

5-
type WithOptionalAuthenticatedUser<P extends object> = Pick<P, Exclude<keyof P, 'authenticatedUser'>> & {
6-
authenticatedUser: GQL.IUser | null
7-
}
8-
95
/**
106
* Wraps a React component and requires an authenticated user. If the viewer is not authenticated, it redirects to
117
* the sign-in flow.
128
*/
139
export const withAuthenticatedUser = <P extends object & { authenticatedUser: GQL.IUser }>(
1410
Component: React.ComponentType<P>
15-
): React.ComponentType<WithOptionalAuthenticatedUser<P>> => props => {
16-
const { authenticatedUser } = props
11+
): React.ComponentType<Pick<P, Exclude<keyof P, 'authenticatedUser'>> & { authenticatedUser: GQL.IUser | null }> => ({
12+
authenticatedUser,
13+
...props
14+
}) => {
1715
// If not logged in, redirect to sign in.
1816
if (!authenticatedUser) {
1917
const newUrl = new URL(window.location.href)
@@ -22,5 +20,5 @@ export const withAuthenticatedUser = <P extends object & { authenticatedUser: GQ
2220
newUrl.searchParams.set('returnTo', window.location.href)
2321
return <Redirect to={newUrl.pathname + newUrl.search} />
2422
}
25-
return <Component {...props} authenticatedUser={authenticatedUser} />
23+
return <Component {...{ ...props, authenticatedUser } as P} />
2624
}

web/src/components/FilteredConnection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class ConnectionNodes<C extends Connection<N>, N, NP = {}> extends React.PureCom
144144

145145
public render(): JSX.Element | null {
146146
const NodeComponent = this.props.nodeComponent
147-
const ListComponent = this.props.listComponent || 'ul'
147+
const ListComponent: any = this.props.listComponent || 'ul' // TODO: remove cast when https://github.com/Microsoft/TypeScript/issues/28768 is fixed
148148
const HeadComponent = this.props.headComponent
149149
const FootComponent = this.props.footComponent
150150

@@ -218,7 +218,7 @@ class ConnectionNodes<C extends Connection<N>, N, NP = {}> extends React.PureCom
218218
}
219219

220220
const nodes = this.props.connection.nodes.map((node, i) => (
221-
<NodeComponent key={hasID(node) ? node.id : i} node={node} {...this.props.nodeComponentProps} />
221+
<NodeComponent key={hasID(node) ? node.id : i} node={node} {...this.props.nodeComponentProps!} />
222222
))
223223

224224
return (

web/src/enterprise/dotcom/productSubscriptions/ProductSubscriptionLabel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ export const ProductSubscriptionLabel: React.FunctionComponent<{
1818
planField?: 'name' | 'nameWithBrand'
1919

2020
className?: string
21-
}> = ({ productSubscription, planField = 'nameWithBrand', className = '' }) => (
21+
}> = ({ productSubscription, planField, className = '' }) => (
2222
<span className={className}>
2323
{productSubscription.invoiceItem ? (
2424
<>
25-
{productSubscription.invoiceItem.plan[planField]} (
25+
{productSubscription.invoiceItem.plan[planField || 'nameWithBrand']} (
2626
{formatUserCount(productSubscription.invoiceItem.userCount)})
2727
</>
2828
) : productSubscription.activeLicense && productSubscription.activeLicense.info ? (

yarn.lock

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14461,11 +14461,16 @@ typedoc@^0.13.0:
1446114461
typedoc-default-themes "^0.5.0"
1446214462
typescript "3.1.x"
1446314463

14464-
[email protected], typescript@^3.1.6:
14464+
1446514465
version "3.1.6"
1446614466
resolved "https://registry.npmjs.org/typescript/-/typescript-3.1.6.tgz#b6543a83cfc8c2befb3f4c8fba6896f5b0c9be68"
1446714467
integrity sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==
1446814468

14469+
typescript@^3.2.1:
14470+
version "3.2.1"
14471+
resolved "https://registry.npmjs.org/typescript/-/typescript-3.2.1.tgz#0b7a04b8cf3868188de914d9568bd030f0c56192"
14472+
integrity sha512-jw7P2z/h6aPT4AENXDGjcfHTu5CSqzsbZc6YlUIebTyBAq8XaKp78x7VcSh30xwSCcsu5irZkYZUSFP1MrAMbg==
14473+
1446914474
ua-parser-js@^0.7.18:
1447014475
version "0.7.19"
1447114476
resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b"

0 commit comments

Comments
 (0)