question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is the TypeScript type definition wrong?

See original GitHub issue

As follow-up of a discussion started in #986, is the TypeScript definition wrong?

The definition is quite huge, ~1200 lines. The main reason for this is because it prevents TS users to do things like test.serial.serial or test.before.after, etc. But as noted by @thejameskyle, this isn’t really representing the runtime structure of AVA.

Also test.serial.serial is not an invalid combination. option-chain is designed so that the latter properties in the chain take precedence.

So although it looks weird and nobody should do it, it’s perfectly possible and maybe shouldn’t be restricted by the type definition?

These things should/can be prevented by the AVA ESLint rule. This means off course, we should create a AVA TSLint rule as well.

Just wanted to start the discussion over here. Everybody that has useful insights, feedback or whatever, feel free to chime in.

// @ivogabe @sindresorhus @novemberborn @jamestalmage

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
jamiebuildscommented, Aug 30, 2016

I think I’ll respond to all of that by saying please don’t add complexity for complexity’s sake when there is no noticeable positive impact to anyone.

Enforcing this means:

Cons:

  • Writing generation scripts for types for both Flow and TypeScript
    • Making contribution harder
      • Making it far more likely to fall out of date
  • Writing an option to the option-chain library that adds a bunch of complexity
    • You’ll have to deal with conflict resolution
    • And you still haven’t dealt with broad => specific option groups, which is an api nightmare

Pros:

  • People won’t be able to do the thing they are already not doing and doesn’t cause any issues either way
1reaction
ivogabecommented, Aug 30, 2016

@rcorrear context for beforeEach/afterEach was fixed in #1008. I’ve got a fix for always in #1025.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to overwrite incorrect TypeScript type definition installed ...
How to overwrite incorrect TypeScript type definition installed via @types/package · You can just add a new interface with the same name as...
Read more >
Documentation - Do's and Don'ts - TypeScript
❌ Don't ever use the types Number , String , Boolean , Symbol , or Object These types refer to non-primitive boxed objects...
Read more >
Typescript: Realistic type definition errors #35247 - GitHub
This first example shows the kind of errors I run into in actual development. It's totally unreadable.
Read more >
Surviving the TypeScript Ecosystem — Part 4 - Medium
We've told TypeScript there is a module called “lodash” and that it has a function called “fake”. This is wrong of course, but...
Read more >
Exception Handling - TypeScript Deep Dive - Gitbook
Error Sub Types · RangeError · ReferenceError · SyntaxError · TypeError · URIError.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found