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

Add more docs on working with Typescript + Polymer #33

Open
LarsDenBakker opened this issue Jan 9, 2018 · 3 comments
Open

Add more docs on working with Typescript + Polymer #33

LarsDenBakker opened this issue Jan 9, 2018 · 3 comments

Comments

@LarsDenBakker
Copy link

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.

@aomarks
Copy link
Member

aomarks commented Aug 11, 2018

We're not going to be investing further in 2.x support for this library, so we recommend moving to Polymer 3.0 and using the new https://www.npmjs.com/package/@polymer/decorators package.

@aomarks aomarks closed this as completed Aug 11, 2018
@yebrahim
Copy link

yebrahim commented Aug 11, 2018

For anyone who comes across this, I put together a small Polymer 2 + Typescript + Webpack + polymer-decorators with Javascript modules support here: https://github.com/yebrahim/polymer2-typescript-webpack, hope it might help.

@aomarks
Copy link
Member

aomarks commented Aug 12, 2018

Actually let's keep this open, it could still be useful to have some more practical docs around usage with 3.0. See also Polymer/old-docs-site#2439

@aomarks aomarks reopened this Aug 12, 2018
@aomarks aomarks changed the title Add more docs on working with Typescript + Polymer 2 Add more docs on working with Typescript + Polymer Aug 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants