Coder Social home page Coder Social logo

lit-events-and-attributes's Introduction

purpose

This extension is stil in development. It's meant as a support for working with the Lit-HTML framework in combination with javascript. together with the extension "lit-html" and "lit-plugin" it's meant to increase the type-safety for javascript code in combination with web-components. using those two plugins the only two risks for said topic are:

  • component attributes having only simple types like Object, Array, String, Number, Boolean
  • component event types not being inferred to the javascript binding ((e) => { ... } e being any type)

solution

complex component attribute types

As there happens to be a problem with typescript supporting advanced type checks (typeof), this plugin runs a check on all files on the system, subscribing on file changes. it checks both the component attribute definition type and parses the value type using typescript libraries. afterwards it compares the string of both values. This should work both for primitive types, for exact type names and for anonymous object.

event type detection

it is literally impossible to add additional types, both to typescript checks as well as to vscode inferred language types. as a measure against this problem this extension is enriching all UI-APIs the IDE is providing (hover, autocomplete, navigation, ...). As a base for the new result this extension uses typescript, invisible updating the source file with the inferred event type from the component as JSDOC.

However, there are limits on how far this approach can go, so the warning developers get with "noImplicitAny" cannot be suppressed. as a measurement this extension will have a custom "noImplicitAny" rule and detect it through the workspace. Using typescript libraries as a base.

Disclaimer

This extensions is not a professional vscode extension. I don't guarantee any kind of working experience. Development might stagnate. Bugs might not be fixed anytime soon, this extension itself might disappear. Don't expect anything from it.

lit-events-and-attributes's People

Contributors

kokujou avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.