Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needs editor tooling #3

Open
0kku opened this issue May 7, 2020 · 0 comments
Open

Needs editor tooling #3

0kku opened this issue May 7, 2020 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@0kku
Copy link
Owner

0kku commented May 7, 2020

It should conceivably be possible to type-check slots in HTML templates (html` `). However, this would require an editor extension, or a plugin to TypeScript language services. I don't know what the most practical approach would be, or where to even get started. Needs investigation.

  • Normal attributes (no namespace) should be strings
  • Properties (prop:) assign to a property on the DOM object of the element, so it should use the interface of the element in question. For example, with <input type=checkbox prop:checked=${foo}>, foo should be boolean, because HTMLInputElement.checked is boolean.
  • Event listeneres (on:) add event listeners using HTMLElement::addEventListener(), so it should be type-checked accordingly. Example: <div on:click=${"hello!"}></div> should error, because the event handler should be a function, not a string.
  • Method calls (call:) call a method on the element in question. Ex: <form call:request-submit=${[]}></form> calls HTMLFormElement::requestSubmit(). It shouldn't allow it to be called incorrectly.
  • destiny: namespace specifies custom lib-specific behavior, that should be easy enough to type-check if the rest is implemented.
@0kku 0kku added enhancement New feature or request help wanted Extra attention is needed labels May 7, 2020
@0kku 0kku added this to the Future milestone Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant