Skip to content

Commit 536030a

Browse files
committed
Generate typings for Polymer 3.
- Publishing (actually packing) will now generate the typings and fail if they don't compile. - Travis will now generate the typings and fail if they don't compile. - Some minor tweaks to get typings compiling.
1 parent 8f6a962 commit 536030a

File tree

10 files changed

+1909
-2686
lines changed

10 files changed

+1909
-2686
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ npm-debug.log
1515

1616
# Analyzer output used in the docs
1717
analysis.json
18+
19+
# NPM artifact
20+
polymer-polymer-*.tgz
21+
22+
# Typings are generated upon publish to NPM
23+
*.d.ts

.npmignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# dependencies
2+
bower_components
3+
node_modules
4+
5+
# compiled output
6+
dist
7+
8+
# IDEs
9+
.idea
10+
.vscode
11+
12+
# misc
13+
.DS_Store
14+
npm-debug.log
15+
16+
# Analyzer output used in the docs
17+
analysis.json
18+
19+
# NPM artifact
20+
polymer-polymer-*.tgz

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ before_script:
1212
- npm install -g gulp-cli@1
1313
- gulp lint-eslint
1414
script:
15+
- npm run generate-types
1516
- node ./node_modules/.bin/polymer test --npm --module-resolution=node -l chrome
1617
- node ./node_modules/.bin/polymer test --npm --module-resolution=node -l firefox
1718
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then travis_wait 30 ./util/travis-sauce-test.sh; fi

externs/closure-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Polymer_TemplateStamp.prototype._addMethodEventListenerToNode = function(node, e
246246
*/
247247
Polymer_TemplateStamp.prototype._addEventListenerToNode = function(node, eventName, handler){};
248248
/**
249-
* @param {Node} node Node to remove event listener from
249+
* @param {!Node} node Node to remove event listener from
250250
* @param {string} eventName Name of event
251251
* @param {function (!Event): void} handler Listener function to remove
252252
* @return {void}

gulpfile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ gulp.task('generate-externs', gulp.series('clean', async () => {
117117

118118
gulp.task('generate-typescript', async () => {
119119
let genTs = require('@polymer/gen-typescript-declarations').generateDeclarations;
120-
await del(['types/**/*.d.ts', '!types/extra-types.d.ts']);
121-
const config = await fs.readJson('gen-tsd.json');
122-
const files = await genTs('.', config);
120+
await del(['**/*.d.ts', '!interfaces.d.ts', '!node_modules/**']);
121+
const config = await fs.readJson(path.join(__dirname, 'gen-tsd.json'));
122+
const files = await genTs(__dirname, config);
123123
for (const [filePath, contents] of files) {
124-
await fs.outputFile(path.join('types', filePath), contents);
124+
await fs.outputFile(path.join(__dirname, filePath), contents);
125125
}
126126
});
127127

lib/mixins/property-effects.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,9 +1678,9 @@ export const PropertyEffects = dedupingMixin(superClass => {
16781678
* a specific order (compute, propagate, reflect, observe, notify).
16791679
*
16801680
* @param {!Object} currentProps Bag of all current accessor values
1681-
* @param {!Object} changedProps Bag of properties changed since the last
1681+
* @param {?Object} changedProps Bag of properties changed since the last
16821682
* call to `_propertiesChanged`
1683-
* @param {!Object} oldProps Bag of previous values for each property
1683+
* @param {?Object} oldProps Bag of previous values for each property
16841684
* in `changedProps`
16851685
* @return {void}
16861686
*/

lib/mixins/template-stamp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ export const TemplateStamp = dedupingMixin(
475475
/**
476476
* Override point for adding custom or simulated event handling.
477477
*
478-
* @param {Node} node Node to remove event listener from
478+
* @param {!Node} node Node to remove event listener from
479479
* @param {string} eventName Name of event
480480
* @param {function(!Event):void} handler Listener function to remove
481481
* @return {void}

0 commit comments

Comments
 (0)