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

fix: make auto-resolve to the root module when importing typings #2645

Merged
merged 2 commits into from
Apr 3, 2019
Merged

fix: make auto-resolve to the root module when importing typings #2645

merged 2 commits into from
Apr 3, 2019

Conversation

joshstevens19
Copy link
Contributor

@joshstevens19 joshstevens19 commented Apr 3, 2019

Description

At the moment when you auto-import types VSCODE resolves it to for which is awesome. In web3 case it resolves it wrongly.. example:

import { EncryptedKeystoreV3Json } from 'web3-eth-accounts/types';

it should be

import { EncryptedKeystoreV3Json } from 'web3-eth-accounts';

It shouldn't resolve with the types at the end as we defined it in types in the package.jsons. Looking at the types in the package.jsons they're incorrect.

"types": "types" should be > "types": "types/index.d.ts"

My changes will fix this so it auto-imports straight to the module itself.

Most people wont see the issues when going to the types path but once you webpack it for example in angulars cli it throws a error until you remove it. Again this will resolve all of that.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Enhancement

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no warnings.
  • I have updated or added types for all modules I've changed
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run test in the root folder with success and extended the tests if necessary.
  • I ran npm run build in the root folder and tested it in the browser and with node.
  • I ran npm run dtslint in the root folder and tested that all my types are correct
  • I have tested my code on an ethereum test network.

@joshstevens19 joshstevens19 changed the title fix: make VSCODE autoresolve to the root module fix: make auto-resolve to the root module when importing typings Apr 3, 2019
@joshstevens19 joshstevens19 requested a review from nivida April 3, 2019 17:51
@joshstevens19 joshstevens19 added the Types Incorrect or missing types label Apr 3, 2019
@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.374% when pulling 4dc4108 on joshstevens19:@types/fix-auto-imports into c9486cb on ethereum:1.0.

@coveralls
Copy link

coveralls commented Apr 3, 2019

Coverage Status

Coverage remained the same at 95.374% when pulling 4dc4108 on joshstevens19:@types/fix-auto-imports into c9486cb on ethereum:1.0.

@nivida nivida merged commit c5372b6 into web3:1.0 Apr 3, 2019
@joshstevens19 joshstevens19 deleted the @types/fix-auto-imports branch April 17, 2019 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Types Incorrect or missing types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants