Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4869

Typescript, Decorators in sub-folders of in-repo add-ons

$
0
0

We develop many ember apps for different clients and have adopted a coding approach in our ember development process where reusable aspects of projects are put into an in-repo add-on to help maintain abstraction, encapsulation, and in many cases, to make them easier to extract into external add-ons for re-use in other projects.

We also use Typescript, and we have two current lint issues that arise during use of VS Code during development:

  • The first is that the export within each file under the app folder in each add-on always highlights a “Cannot find module ‘my-addon/file-being-imported’ or its corresponding type declarations” error - our overall tsconfig does have the proper paths entry
  • The second is that any use of decorators in the in-repo add-on at the top level of the addon folder is fine, but any use in a subfolder is not, unless that subfolder is imported into a top-level folder (by creating an index.d.ts file for example) - we see the old “Experimental support for decorators… ts(1219)” error - it’s as though Typescript doesn’t know this file is part of the project, and perhaps that’s because the generator for the tsconfig has paths for “my-addon” and “my-addon/*” but not “my-addon/**” which, it turns out, is illegal.

None of this stops successful compilation, but it has the effect of burying real lint issues in the IDE underneath hundreds of spurious errors.

Hoping there’s a “quick-fix” to both issues.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4869

Trending Articles