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.

Add index.d.ts (TypeScript)

See original GitHub issue

Environment

  • react-advanaced-form: 1.4.0

What

I suggest to add a separate index.d.ts file for TypeScript annotations.

Why

To provide a more friendly on-boarding for TypeScript users. Also, in relation to #4, this suggestion doesn’t mean to use TypeScript for the library itself. Nothing should change under the hood.

Materials

How

This change is meant to be done gradually. Issue your pull requests to the master with the changes done to index.d.ts to get them reviewed.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kettanaitocommented, Nov 3, 2018

@ell10t Yeah, the problem would be that developer is in charge of the property name under which the value of a field is stored. It would be impossible, and unnecessary, to assume the end field state. There may be, however, some smart usage of generics to achieve this dynamic property behavior.

I will try to read about it, and polish the typings further, so we could publish the first draft somewhere this months.

1reaction
lemciicommented, Oct 31, 2018

Sounds good to me.

No rush, just some notes:

  • Due to field groups ValidationMessages and ValidationSchema name children aren’t as strict as I would’ve hoped
    • I doubt there’s anything we can do about that
  • There are a few parts I haven’t looked into properly, for visibility I’ve stuck // ? at the end of those lines
Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Creating .d.ts Files from .js files - TypeScript
Run the TypeScript compiler to generate the corresponding d.ts files for JS files; (optional) Edit your package.json to reference the types. Adding TypeScript....
Read more >
What is the main usage of index.d.ts in Typescript?
*.d.ts files are used to provide typescript type information about a module that's written in JavaScript, for example, underscore / lodash ...
Read more >
How do I get an index.d.ts file : r/typescript - Reddit
I'm trying to publish to DefinitelyTyped and noticed everyone is putting up one definitions file, index.d.ts , which contains a summary of ...
Read more >
What is the correct way to write a .d.ts file for a node ... - GitHub
So, i am working on a small module written in JS, but I want to make it easy to use that module in...
Read more >
Handbook - Creating .d.ts Files from .js files - TypeScript
Add TypeScript to your dev dependencies · Add a tsconfig.json to configure TypeScript · Run the TypeScript compiler to generate the corresponding d.ts...
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