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

feat: add typings #90

Merged
merged 7 commits into from
Feb 5, 2019
Merged

feat: add typings #90

merged 7 commits into from
Feb 5, 2019

Conversation

jannikkeye
Copy link
Contributor

This PR adds the typings from DefinitelyTyped (slightly modified) to the main org repo.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

Good work, a couple of nits.

@@ -0,0 +1,35 @@
import fastify = require("fastify");
Copy link
Member

Choose a reason for hiding this comment

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

I think those come witha license header that we should likely maintain here with some notes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I modified the typings (last commit) to use fastify.Plugin and did a minor change on the setHeaders function. Since it is not direct copy of the typings from definitelyTyped I should we still include the header?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I could add this?

// Original Definitions by: Leonhard Melzer <https://github.com/leomelzer>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The creator is a colleague of mine, I'll consult with him.

Choose a reason for hiding this comment

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

We could follow the DefinitelyTyped proposal: https://github.com/DefinitelyTyped/DefinitelyTyped#edit-an-existing-package

// Definitions by: Jannik <https://github.com/jannikkeye>
//                 Leo <https://github.com/leomelzer>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds good. I'll set it like you proposed and omit all the DefinitelyTyped related stuff.


const app = Fastify()

app.register<fastifyStatic.FastifyStaticOptions>(fastifyStatic, options)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test for sendFile as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a test case.

@leomelzer
Copy link

Thanks @jannikkeye 🎉

We should make sure to remove the original typings from DefinitetlyTyped to remove confusion:

You can remove it by running npm run not-needed -- typingsPackageName asOfVersion sourceRepoURL [libraryName].

In DefinitelyTyped:

=> npm run not-needed -- fastify-static 2.2.0 https://github.com/fastify/fastify-static

2.2.0 or whatever version this release will become :)

Can you take care of that after the release?

@jannikkeye
Copy link
Contributor Author

@leomelzer yes I can take care of that. I'll have to do it for another package as well anyway. 👍

index.d.ts Show resolved Hide resolved
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@mcollina mcollina merged commit f17a8e8 into fastify:master Feb 5, 2019
@jannikkeye jannikkeye deleted the typings branch February 5, 2019 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants