broccolijs / broccoli-persistent-filter

MIT License
12 stars 33 forks source link

Typescript issues with 3.0 release. #196

Closed chriseppstein closed 4 years ago

chriseppstein commented 4 years ago

Typescript is picking up the .ts files in the package instead of the .d.ts files because they're all in the same directory together. This causes the packages that don't have types to become errors in projects that have noImplicitAny set to true (The rules in a .d.ts file are different with respect to noImplicitAny - it's not enforced there).

I know you don't like it, but it seems like the official recommendation from the typescript maintainers is that either we don't ship .ts files or we ship the compiled output from a different directory than the sources.

The problem with not shipping the .ts files is that sourcemaps won't work right especially with definitionSourcemaps enabled -- even if definition sourcemaps supported inline source maps, it wouldn't work correctly in vscode.

So the options appear to be:

1a. Keep the current directory layout; disable sourcemaps; exclude *.ts from the package.json. 1b. Same as 1a but with inline sourcemaps + sources inline.

  1. Change the directory layout; keep sourcemaps enabled and keep *.ts in the package.json.
  2. Get official types into 7 packages that broccoli-persistent-filter uses or get official @types packages for them.

My preference is for option 2. Thoughts?

rwjblue commented 4 years ago

This seems roughly the same as what is described in https://github.com/stefanpenner/fs-tree-diff/issues/93 right?

chriseppstein commented 4 years ago

Yeah. Same thing. I think it's fine to publish *.ts files, but they just need to be in a different directory.

stefanpenner commented 4 years ago
  1. Change the directory layout; keep sourcemaps enabled and keep *.ts in the package.json.

This is unfortunate, but seems like the most pragmatic approach