Commit Graph

7 Commits (f9fe892937e254d783192c904cc6b6d1543ba03f)

Author SHA1 Message Date
OFF0 f9fe892937
main: convert remaining main to typescript 1 year ago
OFF0 efda7737c8
utils: move updateelemheight to dom utils 1 year ago
OFF0 cadd0302a5
utils: cleanup and move isvalidurl to utils/url 1 year ago
OFF0 23188c161f
utils: move lock and unlock scroll functions to utils 1 year ago
OFF0 6e404eac6b
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'});
1 year ago
OFF0 489a260427
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'
1 year ago
OFF0 fa97027321
refactor: type view.ts, dom.ts and time.ts 1 year ago