Skip to content

Commit aab847e

Browse files
authored
Use downlevel-dts, test compile in TS 3.4 (#936)
* Use downlevel-dts, test compile in TS 3.4 * Use ~ for typescript dep range This way, when someone checks out lit-element to develop it, `npm install` won't give them an untested version of TypeScript, which could cause compiler errors unrelated to any changes they may have made. * Treat ts3.r/tsconfig.json as build output.
1 parent 0eda741 commit aab847e

File tree

5 files changed

+66
-8
lines changed

5 files changed

+66
-8
lines changed
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build in TSC 3.4
2+
3+
on: [push, pull_request]
4+
5+
6+
jobs:
7+
build_old:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v1
13+
with:
14+
node-version: 12
15+
16+
- name: NPM install
17+
run: npm ci
18+
19+
- name: Build
20+
run: npm run build
21+
22+
- name: Install typescript@~3.4
23+
run: npm install typescript@~3.4
24+
25+
- name: Print TypeScript version
26+
run: npx tsc --version
27+
28+
- name: Type check .d.ts files
29+
run: npx tsc ts3.4/lit-element.d.ts --noEmit -t esnext --moduleResolution Node

.gitignore

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/node_modules/
2-
/lib/
32

43
#Compiler Output
5-
lit-element.js
6-
lit-element.js.map
7-
lit-element.d.ts
8-
lit-element.d.ts.map
4+
/lib/
5+
/ts3.4/
6+
7+
/lit-element.js
8+
/lit-element.js.map
9+
/lit-element.d.ts
10+
/lit-element.d.ts.map
911

1012
/test/**/*.d.ts
1113
/test/**/*.d.ts.map

.npmignore

+9
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
11
docs/
2+
.travis.yml
3+
check-version-tracker.js
4+
rollup.config.js
5+
tslint.json
6+
tsconfig_apidoc.json
7+
wct.conf.json
8+
.vscode/
9+
.github/
10+
.clang-format

package-lock.json

+11-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"/lit-element.js.map"
2222
],
2323
"scripts": {
24-
"build": "tsc",
24+
"build": "tsc && downlevel-dts . ts3.4 && cp tsconfig.json ./ts3.4/",
2525
"build:babel-test": "babel src/test/lib/decorators_test.ts --out-file test/lib/decorators-babel_test.js",
2626
"gen-docs": "typedoc --readme docs/_api/api-readme.md --tsconfig tsconfig_apidoc.json --mode modules --theme docs/_api/theme --excludeNotExported --excludePrivate --ignoreCompilerErrors --exclude '{**/*test*,**/node_modules/**,**/test/**}' --out ./docs/api --gaID UA-39334307-23 src/**/*.ts",
2727
"test": "npm run build && npm run build:babel-test && wct",
@@ -46,6 +46,7 @@
4646
"@webcomponents/webcomponentsjs": "^2.2.3",
4747
"chai": "^4.0.2",
4848
"clang-format": "^1.2.4",
49+
"downlevel-dts": "^0.4.0",
4950
"lit-element-benchmarks": "^0.1.0",
5051
"mocha": "^6.2.2",
5152
"np": "^5.2.1",
@@ -56,12 +57,19 @@
5657
"tachometer": "^0.4.16",
5758
"tslint": "^5.20.1",
5859
"typedoc": "^0.14.2",
59-
"typescript": "^3.8.2",
60+
"typescript": "~3.8.2",
6061
"uglify-es": "^3.3.9",
6162
"wct-mocha": "^1.0.0",
6263
"web-component-tester": "^6.9.2"
6364
},
6465
"typings": "lit-element.d.ts",
66+
"typesVersions": {
67+
"<3.8": {
68+
"*": [
69+
"ts3.4/*"
70+
]
71+
}
72+
},
6573
"dependencies": {
6674
"lit-html": "^1.1.1"
6775
},

0 commit comments

Comments
 (0)