fix: update typescript to latest 3 and fix errors

This commit is contained in:
jorenbroekema 2020-11-09 13:09:23 +01:00
parent 19117ea973
commit 2e95029b0a
10 changed files with 3009 additions and 312 deletions

3291
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -77,7 +77,7 @@
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"rollup": "^2.0.0", "rollup": "^2.0.0",
"sinon": "^7.2.2", "sinon": "^7.2.2",
"typescript": "^3.8.3", "typescript": "3.9.7",
"web-component-analyzer": "^1.0.3", "web-component-analyzer": "^1.0.3",
"webpack-merge": "^4.1.5", "webpack-merge": "^4.1.5",
"whatwg-fetch": "^3.0.0" "whatwg-fetch": "^3.0.0"

View file

@ -333,7 +333,7 @@ export class LionAccordion extends LitElement {
if (!(this.__store && this.__store[this.focusedIndex])) { if (!(this.__store && this.__store[this.focusedIndex])) {
return; return;
} }
const previousInvoker = /** @type {HTMLElement | null} */ (Array.from(this.children).find( const previousInvoker = /** @type {HTMLElement | undefined} */ (Array.from(this.children).find(
child => child.slot === 'invoker' && child.firstElementChild?.hasAttribute('focused'), child => child.slot === 'invoker' && child.firstElementChild?.hasAttribute('focused'),
)); ));
if (previousInvoker) { if (previousInvoker) {

View file

@ -2,7 +2,7 @@ import { html, LitElement } from '@lion/core';
/** /**
* @typedef {import('../validate/Validator').Validator} Validator * @typedef {import('../validate/Validator').Validator} Validator
* * @typedef {import('@lion/core').TemplateResult} TemplateResult
* @typedef {Object} messageMap * @typedef {Object} messageMap
* @property {string | Node} message * @property {string | Node} message
* @property {string} type * @property {string} type
@ -23,7 +23,7 @@ export class LionValidationFeedback extends LitElement {
/** /**
* @overridable * @overridable
* @param {Object} opts * @param {Object} opts
* @param {string | Node} opts.message message or feedback node * @param {string | Node | TemplateResult } opts.message message or feedback node or TemplateResult
* @param {string} [opts.type] * @param {string} [opts.type]
* @param {Validator} [opts.validator] * @param {Validator} [opts.validator]
*/ */

View file

@ -9,7 +9,6 @@ import { parseAmount } from './parsers.js';
* `LionInputAmount` is a class for an amount custom form element (`<lion-input-amount>`). * `LionInputAmount` is a class for an amount custom form element (`<lion-input-amount>`).
* *
* @customElement lion-input-amount * @customElement lion-input-amount
* @extends {LionInput}
*/ */
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you. // @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
export class LionInputAmount extends LocalizeMixin(LionInput) { export class LionInputAmount extends LocalizeMixin(LionInput) {
@ -43,7 +42,7 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
el.textContent = this.__currencyLabel; el.textContent = this.__currencyLabel;
return el; return el;
} }
return null; return undefined;
}, },
}; };
} }

View file

@ -70,7 +70,7 @@ export class LionInputDatepicker extends ScopedElementsMixin(
eventContext: this, eventContext: this,
}, },
); );
return renderParent.firstElementChild; return /** @type {HTMLElement} */ (renderParent.firstElementChild);
}, },
}; };
} }

View file

@ -53,6 +53,10 @@ export class LionInputRange extends LocalizeMixin(LionInput) {
`; `;
} }
get _inputNode() {
return /** @type {HTMLInputElement} */ (super._inputNode);
}
constructor() { constructor() {
super(); super();
this.min = Infinity; this.min = Infinity;

View file

@ -7,7 +7,6 @@ import { IsNumber, MinNumber, MaxNumber } from '@lion/form-core';
* *
* @customElement lion-input-stepper * @customElement lion-input-stepper
*/ */
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
export class LionInputStepper extends LionInput { export class LionInputStepper extends LionInput {
static get styles() { static get styles() {
return [ return [
@ -44,6 +43,10 @@ export class LionInputStepper extends LionInput {
return parseFloat(this.value) || 0; return parseFloat(this.value) || 0;
} }
get _inputNode() {
return /** @type {HTMLInputElement} */ (super._inputNode);
}
constructor() { constructor() {
super(); super();
/** @param {string} modelValue */ /** @param {string} modelValue */

View file

@ -34,7 +34,7 @@
"@babel/traverse": "^7.5.5", "@babel/traverse": "^7.5.5",
"@babel/types": "^7.9.0", "@babel/types": "^7.9.0",
"@rollup/plugin-node-resolve": "^7.1.1", "@rollup/plugin-node-resolve": "^7.1.1",
"@typescript-eslint/typescript-estree": "^2.0.0", "@typescript-eslint/typescript-estree": "^3.0.0",
"anymatch": "^3.1.1", "anymatch": "^3.1.1",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"commander": "^2.20.0", "commander": "^2.20.0",
@ -49,8 +49,7 @@
"ora": "^3.4.0", "ora": "^3.4.0",
"parse5": "^5.1.1", "parse5": "^5.1.1",
"read-package-tree": "5.3.1", "read-package-tree": "5.3.1",
"semver": "^7.1.3", "semver": "^7.1.3"
"typescript": "^3.8.3"
}, },
"devDependencies": { "devDependencies": {
"mermaid": "^8.2.6", "mermaid": "^8.2.6",

View file

@ -12,7 +12,8 @@
"alwaysStrict": true, "alwaysStrict": true,
"types": ["node", "mocha", "sinon"], "types": ["node", "mocha", "sinon"],
"esModuleInterop": true, "esModuleInterop": true,
"suppressImplicitAnyIndexErrors": true "suppressImplicitAnyIndexErrors": true,
"skipLibCheck": true
}, },
"include": ["packages/**/*.js"], "include": ["packages/**/*.js"],
"exclude": [ "exclude": [