matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

typescript does not find declarations

Open aanation opened this issue 3 years ago • 3 comments

In this commit you changed the "main" option in package.json.

For this reason, the package in the develop branch does not work (typescript in my project does't know where to take the declarations, and tries to compile the .ts files from the src directory). Your comment says "Resetting package fields for development". Are you sure you haven't forgotten about it? Maybe we should add types/typings section in the develop branch?

I am worried that this change will be released into the npm package


This PR currently has no changelog labels, so will not be included in changelogs.

A reviewer can add one of: T-Deprecation, T-Enhancement, T-Defect, T-Task to indicate what type of change this is, or add Type: [enhancement/defect/task] to the description and I'll add them for you.

aanation avatar Dec 06 '21 13:12 aanation

This is done automatically by the release script (adds it for the the release then removes it again for development) so that, on the develop branch, the default entry point is the typescript version and the types come directly from the source rather than from built types. It's far from an ideal solution, but yes, it is intentional.

dbkr avatar Dec 06 '21 15:12 dbkr

This is done automatically by the release script (adds it for the the release then removes it again for development) so that, on the develop branch, the default entry point is the typescript version and the types come directly from the source rather than from built types. It's far from an ideal solution, but yes, it is intentional.

Okay, that makes me feel better :) However, what prevents you from using the d.ts in the development environment instead of sources?

And another question, if we're talking about declarations. Have you thought about generating single file d.ts + one bundle .js file?

aanation avatar Dec 06 '21 17:12 aanation

However, what prevents you from using the d.ts in the development environment instead of sources?

Having to run tsc in watch mode as a separate process rather than doing everything in a single webpack

t3chguy avatar Dec 06 '21 17:12 t3chguy