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

RFC: <script type="ts/module"> #1459

Open
gertcuykens opened this issue Nov 9, 2016 · 3 comments
Open

RFC: <script type="ts/module"> #1459

gertcuykens opened this issue Nov 9, 2016 · 3 comments

Comments

@gertcuykens
Copy link

If polymer-analyzer can parse typescript we can make the first <script type="ts/module"> proof of concept with the following benefits.

  • more type safety and intellisense on <script type="ts/module"> content in html files
  • option to transpile example.ts.html to example.html with the <script type="ts/module"> content and script type replaced to a normal <script>

filename: example.ts.html

<link rel="import" href="../polymer/polymer-element.html">
<dom-module id="hello-world">
  <template>
    <style>
      :host {
        display: block;
        box-sizing: border-box;
        border: 1px solid red;
        margin-top: 10px;
        padding: 0px 5px;
      }
    </style>
    <p>Test <slot></slot></p>
  </template>
  <script type="ts/module">
    class HelloWorld extends Polymer.Element {
      _hello: string = 'Hello World'
      static get is() {
        let test: string = 'test intelli'
        test.toUpperCase()
        return 'hello-world';
      }
      static get config() {
        return {};
      }
      constructor() {
        super();
      }
      connectedCallback() {
        super.connectedCallback();
      }
    }
    customElements.define(HelloWorld.is, HelloWorld);  
  </script>
</dom-module>

Making polymer-analyzer understand typescript is the first step that needs to be done if we want this to work. All editor plugins depend on the analyser to make sense of <script type="ts/module"> content.

Technical Note: (Based on mhegazy from Microsoft see link below)
If you specify scriptKindName as JS/TS in the TS language service you should be able to buffer the <script type="ts/module"> content directly to get typescript information.

@justinfagnani
Copy link
Contributor

This is blocked on initial TypeScript analysis support.

@matthewp
Copy link

Is there an existing issue for support of <script type="module">? I couldn't find one.

@stale
Copy link

stale bot commented Mar 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants