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

Generate/publish *.ts.d #851

Merged
merged 1 commit into from
Feb 25, 2018
Merged

Conversation

cryptcoin-junkey
Copy link
Contributor

They are very useful in developing stable applications with TypeScript.

They are very useful in developing stable applications with TypeScript.
Copy link
Contributor

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1! Excited to see there's a desire for the consumer type declarations!

For background this wasn't turned off for any particular reason, just to keep the original move to TS simple. So 👍 for turning them on for the next release.

@intelliot
Copy link
Collaborator

@FredKSchott How are declaration files typically used? Is it automatically parsed by editors like VS Code?

@FredKSchott
Copy link
Contributor

Exactly, the definition files (.d.ts) are what allow your editors / editor plugins / build step to understand ripple-lib when it's a dependency and warn when it's used incorrectly.

@intelliot intelliot merged commit 3fe5d71 into XRPLF:develop Feb 25, 2018
intelliot added a commit that referenced this pull request Mar 1, 2018
Fixes TypeScript compile errors:
> Exported variable '…' has or is using private name '…'.

These occur due to generating TS declaration files.

See #851
@cryptcoin-junkey cryptcoin-junkey deleted the pr-generete-ts.d branch March 2, 2018 01:14
intelliot added a commit that referenced this pull request Mar 2, 2018
Fixes TypeScript compile errors due to generating TS declaration files.

See #851
@darkmemo
Copy link
Collaborator

darkmemo commented Mar 4, 2018

Afaik, additionally types property in package.json should point to main types declaration file.

[...]
"main": "dist/npm",
"name": "ripple-lib",
"types": "dist/npm/index.d.ts"
[...]

See https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

Without this I always get Could not find a declaration file for module 'ripple-lib'. '../ripple-lib/dist/npm/index.js' implicitly has an 'any' type... error. (I have "noImplicitAny": true in tsconfig.json.)

When I add "types": "dist/npm/index.d.ts" to package.json of ripple-lib, module and types are resolved correctly. (Using typescript version 2.7.2)

@FredKSchott
Copy link
Contributor

@darkmemo good catch!

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

Successfully merging this pull request may close these issues.

4 participants