Skip to content

Commit c46d43e

Browse files
josephaxisajkaster
andauthored
Update to TypeScript 4.1 (#421)
* Bumped TypeScript version to 4.1.3 * Removed async modifier from abstract method This was a breaking change as of TS 4.x: microsoft/TypeScript#39963 More context: microsoft/TypeScript#25710 (comment) * Removed ts-node from non-root package.json files * Added test:sdk script to root package.json * Fixed specConverter paths * Fixed logical error in declarationMiner.spec.ts * yarn.lock * Fix root path resolution for sdk-rtl testUtils.ts Co-authored-by: John Kaster <[email protected]>
1 parent aadb050 commit c46d43e

File tree

15 files changed

+496
-462
lines changed

15 files changed

+496
-462
lines changed

examples/access-token-server/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
"nodemon": "^2.0.4",
3737
"test": "^0.6.0",
3838
"ts-jest": "^26.4.1",
39-
"ts-node": "^9.0.0",
40-
"typescript": "^4.0.3"
39+
"ts-node": "^9.0.0"
4140
},
4241
"eslintConfig": {
4342
"extends": [

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"test:ts": "yarn jest --reporters=default --reporters=jest-junit",
5151
"test:apix": "yarn jest packages/api-explorer packages/run-it packages/extension-api-explorer",
5252
"test:iphone": "xcodebuild test -project swift/looker/looker.xcodeproj -scheme looker-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.4.1' | xcpretty --test --color",
53+
"test:sdk": "yarn jest packages/sdk",
5354
"test:jest": "DOT_ENV_FILE=.env.test jest",
5455
"bootstrap": "lerna clean -y && lerna bootstrap",
5556
"watch": "lerna run --parallel watch"
@@ -92,9 +93,9 @@
9293
"eslint-plugin-import": "^2.20.2",
9394
"eslint-plugin-mdx": "^1.6.8",
9495
"eslint-plugin-prettier": "^3.1.3",
95-
"jest": "^26.4.0",
96-
"jest-canvas-mock": "^2.2.0",
97-
"jest-junit": "^10.0.0",
96+
"jest": "^26.6.3",
97+
"jest-canvas-mock": "^2.3.0",
98+
"jest-junit": "^12.0.0",
9899
"jest-styled-components": "^7.0.3",
99100
"js-yaml": "^3.13.1",
100101
"lerna": "^3.20.2",
@@ -108,9 +109,9 @@
108109
"react": "^16.13.1",
109110
"react-dom": "^16.13.1",
110111
"styled-components": "^5.2.1",
111-
"ts-jest": "^26.2.0",
112-
"ts-node": "^8.1.0",
113-
"typescript": "3.8.2",
112+
"ts-jest": "^26.4.4",
113+
"ts-node": "^9.1.1",
114+
"typescript": "^4.1.3",
114115
"webpack": "^4.43.0",
115116
"node-forge": "^0.10.0",
116117
"node-uuid": "^1.4.8"
@@ -198,7 +199,6 @@
198199
},
199200
"keywords": [],
200201
"resolutions": {
201-
"set-value": "^2.0.1",
202-
"typescript": "3.8.2"
202+
"set-value": "^2.0.1"
203203
}
204204
}

packages/api-explorer/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,5 @@
6363
"react-router-dom": "^5.1.2",
6464
"styled-components": "^5.2.1",
6565
"ts-jest": "^26.2.0"
66-
},
67-
"resolutions": {
68-
"typescript": "3.8.2"
6966
}
7067
}

packages/extension-api-explorer/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,5 @@
2323
"react-router-dom": "^5.2.0",
2424
"webpack-cli": "^3.3.12",
2525
"webpack-dev-server": "^3.11.0"
26-
},
27-
"resolutions": {
28-
"typescript": "3.8.2"
2926
}
3027
}

packages/hackathon/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
"develop": "webpack-dev-server --hot --disable-host-check --port 8080 --https --config webpack.dev.config.js",
3333
"watch": "yarn lerna exec --scope @looker/wholly-sheet --stream 'BABEL_ENV=build babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --no-comments --watch'"
3434
},
35-
"resolutions": {
36-
"typescript": "3.8.2"
37-
},
3835
"dependencies": {
3936
"@looker/components": "^0.9.28",
4037
"@looker/extension-sdk": "^0.13.0-alpha.1",
@@ -51,8 +48,7 @@
5148
"redux": "^4.0.5",
5249
"redux-saga": "^1.1.3",
5350
"styled-components": "^5.2.1",
54-
"styled-system": "^5.1.2",
55-
"typescript": "3.8.2"
51+
"styled-system": "^5.1.2"
5652
},
5753
"devDependencies": {
5854
"@types/react-redux": "^7.1.9",

packages/run-it/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"react-router-dom": "^5.2.0",
4141
"react-test-renderer": "^17.0.1",
4242
"style-loader": "^1.1.3",
43-
"typescript": "3.8.2",
4443
"webpack-cli": "^3.3.11",
4544
"webpack-dev-server": "^3.10.3"
4645
},
@@ -60,8 +59,5 @@
6059
"react-google-charts": "^3.0.15",
6160
"react-is": "^16.13.1",
6261
"styled-components": "^5.2.1"
63-
},
64-
"resolutions": {
65-
"typescript": "3.8.2"
6662
}
6763
}

packages/sdk-codegen-scripts/src/declarationMiner.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('Declaration miner', () => {
5050

5151
const sourcePath = settings.base_url
5252
const isConfigured = () => settings.base_url
53-
const testIfConfigured = isConfigured ? it : it.skip
53+
const testIfConfigured = isConfigured() ? it : it.skip
5454

5555
testIfConfigured('should mine files matching the probe settings', () => {
5656
const miner = new DeclarationMiner(

packages/sdk-codegen-utils/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,5 @@
2929
],
3030
"scripts": {
3131
"watch": "yarn lerna exec --scope @looker/sdk-codegen-utils --stream 'BABEL_ENV=build babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --no-comments --watch'"
32-
},
33-
"resolutions": {
34-
"typescript": "3.8.2"
3532
}
3633
}

packages/sdk-codegen/src/specConverter.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ const swagger = JSON.parse(swaggerFrag)
402402
const api = JSON.parse(openApiFrag)
403403

404404
const config = TestConfig()
405-
const swaggerFile = `${config.rootPath}/spec/Looker.4.0.json`
406-
const apiFile = `${config.rootPath}/spec/Looker.4.0.oas.json`
405+
const swaggerFile = `${config.rootPath}spec/Looker.4.0.json`
406+
const apiFile = `${config.rootPath}spec/Looker.4.0.oas.json`
407407
const swaggerSource = readFileSync(swaggerFile, 'utf-8')
408408
const fullSwagger = JSON.parse(swaggerSource)
409409
const apiSource = readFileSync(apiFile, 'utf-8')

packages/sdk-rtl/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@
4242
"ini": "^1.3.5",
4343
"readable-stream": "^3.4.0",
4444
"request": "^2.88.0",
45-
"request-promise-native": "^1.0.8",
46-
"ts-node": "^8.4.1",
47-
"typescript": "^3.8.2"
45+
"request-promise-native": "^1.0.8"
4846
},
4947
"keywords": [
5048
"Looker",

packages/sdk-rtl/src/baseTransport.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export abstract class BaseTransport implements ITransport {
6161
* @param options overrides of default transport settings
6262
* @returns typed response of `TSuccess`, or `TError` result
6363
*/
64-
abstract async rawRequest(
64+
abstract rawRequest(
6565
method: HttpMethod,
6666
path: string,
6767
queryParams?: Values,
@@ -80,7 +80,7 @@ export abstract class BaseTransport implements ITransport {
8080
* @param {Partial<ITransportSettings>} options transport option overrides
8181
* @returns {Promise<TSuccess>} the streaming response
8282
*/
83-
abstract async request<TSuccess, TError>(
83+
abstract request<TSuccess, TError>(
8484
method: HttpMethod,
8585
path: string,
8686
queryParams?: any,
@@ -101,7 +101,7 @@ export abstract class BaseTransport implements ITransport {
101101
* @param {Partial<ITransportSettings>} options transport option overrides
102102
* @returns {Promise<TSuccess>} the streaming response
103103
*/
104-
abstract async stream<TSuccess>(
104+
abstract stream<TSuccess>(
105105
callback: (readable: Readable) => Promise<TSuccess>,
106106
method: HttpMethod,
107107
path: string,

packages/sdk-rtl/src/testUtils/testUtils.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
import * as fs from 'fs'
28+
import path from 'path'
2829
import { ApiConfig } from '../nodeSettings'
2930

3031
interface IKeyAny {
@@ -52,17 +53,20 @@ export interface ITestConfig {
5253
testSection: IKeyAny
5354
}
5455

56+
const homeToRoost = '../../../../'
57+
58+
export const getRootPath = () => path.join(__dirname, homeToRoost)
59+
export const rootFile = (fileName = '') => path.join(getRootPath(), fileName)
60+
5561
/**
5662
* Reads configuration information, returning various test values
5763
* @param {string} rootPath
5864
* @returns {{testConfig: {[p: string]: any}; localIni: string; baseUrl: any; testData: any; apiVersion: any; testIni: string; configContents: string; rootPath: string; testSection: any; timeout: number}}
5965
* @constructor
6066
*/
61-
export function TestConfig(rootPath = ''): ITestConfig {
67+
export const TestConfig = (rootPath = ''): ITestConfig => {
6268
const testFile = 'data.yml.json'
63-
if (!rootPath) {
64-
rootPath = fs.existsSync(`test/${testFile}`) ? '' : '../../'
65-
}
69+
rootPath = rootPath || getRootPath()
6670
const localIni = process.env.LOOKERSDK_INI || `${rootPath}looker.ini`
6771
const testPath = `${rootPath}test/`
6872
const dataFile = `${testPath}${testFile}`

packages/sdk/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@
4646
"ini": "^1.3.5",
4747
"readable-stream": "^3.4.0",
4848
"request": "^2.88.0",
49-
"request-promise-native": "^1.0.8",
50-
"ts-node": "^8.4.1",
51-
"typescript": "^3.8.2"
49+
"request-promise-native": "^1.0.8"
5250
},
5351
"keywords": [
5452
"Looker",

packages/wholly-sheet/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
"scripts": {
3131
"watch": "yarn lerna exec --scope @looker/wholly-sheet --stream 'BABEL_ENV=build babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --no-comments --watch'"
3232
},
33-
"resolutions": {
34-
"typescript": "3.8.2"
35-
},
3633
"dependencies": {
3734
"@looker/sdk": "^0.3.7-beta.0",
3835
"@looker/sdk-rtl": "^0.3.7-beta.0",

0 commit comments

Comments
 (0)