Commit Graph

9 Commits (2f5e08de0472d55c8ef5566dded4b975d38d7b87)

Author SHA1 Message Date
OFF0 77ac7de716
utils: move updateelemheight to dom utils 2 years ago
OFF0 f89a06c680
utils: cleanup and move isvalidurl to utils/url 2 years ago
OFF0 fcbf1c4272
utils: move lock and unlock scroll functions to utils 2 years ago
OFF0 4cdbf0349f
utils: import directly from utils
it is not worth to import everything from utils, as there are too
many functions, better import them directly from each module.
2 years ago
OFF0 e170570934
typescript 2 years ago
OFF0 838afa9ed8
refactor: type element attributes
use attributes of html element type.

so that the following example is correctly typed:

elem('input', {
  className: 'foo',
  hidden: false,
  onclick: () => alert('hi'),
  tabIndex: 1,
  valueAsNumber: 1,
});

but this fails as foo is no valid attribute on div element:

elem('div', {foo: 'bar'});
2 years ago
OFF0 334b09afa1
refactor: type elem and enforce inferred generic type
typed elem so that it returns the exact type of the HTMLElement,
and that name must be a key of HTMLElementTagNameMap.

example:

elem('form'); // returns HTMLFormElement

elem('abc'); // not assignable to parameter of type 'keyof HTMLElementTagNameMap'
2 years ago
OFF0 67af695350
refactor: type events.ts, url.ts and crypto.ts 2 years ago
OFF0 5e75b64619
refactor: type view.ts, dom.ts and time.ts 2 years ago