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
Add TypeScript definition #381
Conversation
The previous version had some implicit any casts. Most of them are related to missing void type declarations.
Fix noImplicitAny errors
Also, I think the type definition is a good start, but I think it's not completely correct. For example, beforeEach(fn: (cb: () => any) => Promise | void):void but in reality, the callback optionally receives a |
I've also submitted this as a PR to the PR: dlmanning#3 I feel like I'm being confusing, but I don't know the right process. |
To exercise t.fail, you can create a new Test object and mess around with
it.
I think it might be worth holding off until v11, since some interface stuff
may move around (and get a lot more organized in the process) when I
migrate to using es classes.
…On Tue, Jun 27, 2017 at 11:09 Matt Haggard ***@***.***> wrote:
I've also submitted this as a PR to the PR: dlmanning#3
<dlmanning#3> I feel like I'm being
confusing, but I don't know the right process.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#381 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAkRyIdwVQZNpFwaGDkJZdN0pKk9f7cks5sIUVQgaJpZM4OG-2B>
.
|
@isaacs Over lunch I thought, "what I need is a repository of code that exercises all of Tap." If only such a repository existed... like in the |
The most recent commit is a bunch of failing tests (step 1). If it's a less-than-an-hour exercise, I'll try to make them pass (step 2). Otherwise, I'll wait for v11. |
Here's a summary of the outstanding TypeScript compilation errors. Some of the problems can be fixed in a variety of ways. @isaacs, if you have an opinion on how to fix these, I'd like guidance. Otherwise, I'll use my best judgment. Variable ReuseThese errors are for pieces of code like:
TypeScript doesn't like you to change How to fix it
Instances
Ordering and Optionalsnode-tap is really flexible when it comes to argument order in many functions. I'm struggling to define the declarations that can handle that flexibility. How to fix it
Instances
Type testsSome of the tests are asserting that the type of arguments is correct (e.g. you must pass a number to How to fix it
Instances
MiscIs it okay to assign a number to
Where is
I think maybe this is a bug in the node typings:
IDKI'm not proficient enough with TypeScript to know how to fix these :) How to fix it
Instances
|
Looks like the master branch builds are failing, too. Once master passes tests, I suspect these tests will pass too. |
@isaacs ping? This approach (using node-tap's own tests to test the typescript definition file) would work, no? |
@isaacs this branch uses the existing javascript tests to assert that the type definition works. You do not need to rewrite all the test to TypeScript (because of the How does this work with your criteria:
I don't actually use this lib anymore, but if you'd like, I can prepare examples of each of these to prove it. |
This is picking up on Issue #256. (Aside: Seems weird to make a different PR instead of tracking the conversation and changes in one place. GitHub seems to not allow for otherwise, though)
I've added a "test" (i.e. compile a TypeScript test file). But... I think that the TypeScript test file needs to exercise every function (and function variation) in order to be useful. And my problem is two-fold:
tap.fail("this failed")
) without also making the tests fail.Any ideas?