Skip to content

publishing TS seems surprising #1443

@stefanpenner

Description

@stefanpenner

Hey guys, I was surprised to see ember-cli-typescript encourages folks to publish Typescript.

My expectation was:

  • published .d.ts and .js files, but not .ts files

What i see:

  • published '.d.ts' and '.ts'

Why is I believe this a problem:

  • I believe, but do correct me if I am wrong, but publishing the TS itself isn't the TS recommendation
  • publishing TS, and having the consuming app process creates both a build time and dependency liability penalty on the consuming app.
  • for example, @ember/string today cannot simply install @ember/test-helpers without crashing due to unexpected TS syntax, without updating/fixing its own dependencies.
  • for example, functioning apps now have excessive dependencies which could be "precompiled" away.

My current thoughts on solving (early, but evolving, would love input):

Publish only .js + .d.ts, and have all TS related build dependencies as dev dependencies.
Local add-on development, including linking, would be handled as:

  • tsc -p tsconfig.json --noEmit is used for linting by editor + yarn lint
  • the ember build pipeline would simply strip ts via @babel/preset-typescript (maybe under the hood via https://github.com/stefanpenner/broccoli-babel-preset-typescript)
  • prepublish would produce: (1) babel stripped .js files (2) typescript produced d.ts files
  • .npmignore and .gitignore would be use to ensure only the right files are published and committed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions