Skip to content

Conversation

zsevic
Copy link
Contributor

@zsevic zsevic commented Oct 15, 2019

I wanted to use this package in Hapi/TypeScript project so I had to add this file in node_modules/hapi-dev-errors to work properly.

@marcuspoehls
Copy link
Member

@zsevic Thank you for the PR! I’m not familiar with Typescript yet. I need to read on the TS essentials to wrap my head around it.

Can you please describe what this one-liner does?

I’m mainly interested in the effects that are enabled with when merging this PR.

For example, does this change allow you to import hapi-dev-errors in Typescript`? Why isn’t this hapi plugin working with TS at this point? Should I add a default export?

Thank you for your help!

@zsevic
Copy link
Contributor Author

zsevic commented Oct 15, 2019

index.d.ts is used to provide TypeScript type information about a module that's written in JavaScript. This will allow you to use the JavaScript modules without the need to convert them to TypeScript, without getting any type error on your code.

Here are examples how it looks like for Node and Hapi.

This one-liner is enough to allow importing hapi-dev-errors in TypeScript, default export isn't needed here. You're welcome!

@marcuspoehls marcuspoehls merged commit d309fae into futurestudio:master Oct 15, 2019
@zsevic zsevic deleted the typescript-support branch October 15, 2019 21:45
@marcuspoehls
Copy link
Member

@zsevic Thank you Željko for this addition. I’ve tagged version 3.3.0 containing the TypeScript declaration 👍

@zsevic zsevic changed the title Add TypeScript support Add TypeScript declaration Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants