Skip to content

Add more docs on working with Typescript + Polymer #33

@LarsDenBakker

Description

@LarsDenBakker

There are some quirks when working with Polymer 2 and typescript, especially when using it to develop separately shareable components and not applications. I think it would be good to collect some knowledge on how this is done.

My current workflow consists of:

  • Write .ts files, compile them to .js and include the .js file in a script tag in my .html file. Unfortunately that results
  • I use typescript namespaces, as modules are not supported at runtime by polymer tooling
  • I use the "noEmitHelpers" option in my tsconfig to prevent small helper functions popping up in every .js file. I then include tslib (https://github.com/Microsoft/tslib) globally. If we were using modules, we could have used the "importHelpers" which is the most documented configuration. This does not work with namespaces however, and it will still emit the helper functions. Eventually I found the "noEmitHelpers" option but it is not very well documented.

All in all it's a bit cumbersome, so I'm wondering if there are better workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions