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

Types for existing npm package subleveldown with tests #40754

Merged
merged 16 commits into from
Dec 26, 2019

Conversation

carsonfarmer
Copy link
Contributor

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If adding a new definition:

  • The package does not already provide its own types, or cannot have its .d.ts files generated via --declaration
  • If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • Represents shape of module/library correctly
  • tslint.json should be present and it shouldn't have any additional or disabling of rules. Just content as { "extends": "dtslint/dt.json" }. If for reason the some rule need to be disabled, disable it for that line using // tslint:disable-next-line [ruleName] and not for whole package so that the need for disabling can be reviewed.
  • tsconfig.json should have noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes set to true.

Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
@typescript-bot
Copy link
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to subleveldown with its source on master.

Comparison details 📊
Batch compilation
Type count 10170
Assignability cache size 3452
Language service measurements
Samples taken 135
Identifiers in tests 135
getCompletionsAtPosition
    Mean duration (ms) 388.1
    Mean CV 11.0%
    Worst duration (ms) 518.9
    Worst identifier console
getQuickInfoAtPosition
    Mean duration (ms) 405.7
    Mean CV 11.3%
    Worst duration (ms) 560.8
    Worst identifier clear
System information
Node version v12.13.0
CPU count 2
CPU speed 2.397 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1061-azure

@typescript-bot typescript-bot added New Definition This PR creates a new definition package. Awaiting reviewer feedback labels Dec 1, 2019
@typescript-bot
Copy link
Contributor

typescript-bot commented Dec 1, 2019

@carsonfarmer Thank you for submitting this PR!

Because this is a new definition, a DefinitelyTyped maintainer will be reviewing this PR in the next few days once the Travis CI build passes.

In the meantime, if the build fails or a merge conflict occurs, I'll let you know. Have a nice day!

Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
types/subleveldown/index.d.ts Outdated Show resolved Hide resolved
types/subleveldown/index.d.ts Outdated Show resolved Hide resolved
types/subleveldown/index.d.ts Outdated Show resolved Hide resolved
types/subleveldown/index.d.ts Outdated Show resolved Hide resolved
types/subleveldown/index.d.ts Outdated Show resolved Hide resolved
@typescript-bot typescript-bot moved this from Review to Needs Author Attention in Pull Request Status Board Dec 1, 2019
@typescript-bot typescript-bot added Revision needed This PR needs code changes before it can be merged. and removed Awaiting reviewer feedback labels Dec 1, 2019
@typescript-bot
Copy link
Contributor

@carsonfarmer One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. Thank you!

Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
@carsonfarmer
Copy link
Contributor Author

Thank you @demensky for your thorough and helpful review! I've addressed most of your comments, and have one open question left for some clarification.

@typescript-bot
Copy link
Contributor

🔔 @demensky - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate?

Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
Copy link
Contributor Author

@carsonfarmer carsonfarmer left a comment

Choose a reason for hiding this comment

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

I hope these updates are 'ok' (they are a departure from the original submission). Additional changes are also expected upon answering one remaining question.

types/subleveldown/index.d.ts Outdated Show resolved Hide resolved
types/subleveldown/index.d.ts Outdated Show resolved Hide resolved
Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
@carsonfarmer
Copy link
Contributor Author

More updates, I'm still new to some aspects of Typescript defs, so I hope this is now pretty clear.

The most recent updates allow the types to reflect arbitrary key/value types in each sublevel, which is an explicit requirement of the package: https://github.com/Level/subleveldown#background. The tests have been updated to explicitly check for this.

@carsonfarmer
Copy link
Contributor Author

Thanks again to @demensky! I look forward to your (hopefully final) review, and am happy to make any additional changes as needed. I suspect we can actually simplify things a great deal here.

Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
@carsonfarmer
Copy link
Contributor Author

Apologies to anyone following this work, I accidentally pushed a ton of commits to this branch. I've now force-pushed the the branch from 98f2143 to 3ba1bbe... hopefully this doesn't cause you any issues!

Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
@carsonfarmer
Copy link
Contributor Author

Ok, I'm happy with the final product here @demensky! I've made one last commit to add your name to the header, I hope this is ok? Otherwise, I think we're good to go here?

@typescript-bot typescript-bot moved this from Needs Author Attention to Review in Pull Request Status Board Dec 7, 2019
@typescript-bot typescript-bot added Other Approved This PR was reviewed and signed-off by a community member. Awaiting reviewer feedback labels Dec 7, 2019
@typescript-bot
Copy link
Contributor

We've gotten sign-off from a reviewer 👏. A maintainer will soon review this PR and merge it if there are no issues. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for contributing to DefinitelyTyped!

@carsonfarmer
Copy link
Contributor Author

I think this one is ready to go. It seems like the Revision needed label got left on for some reason?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Definition This PR creates a new definition package. Other Approved This PR was reviewed and signed-off by a community member. Revision needed This PR needs code changes before it can be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants