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

Add TS types #6

Merged
merged 1 commit into from
Nov 24, 2021
Merged

Add TS types #6

merged 1 commit into from
Nov 24, 2021

Conversation

orgads
Copy link
Contributor

@orgads orgads commented Oct 10, 2021

Copied from DefinitelyTyped.

@jankapunkt
Copy link
Member

Thank you @orgads can you please make this independent from express? // cc @HappyZombies

@HappyZombies
Copy link
Member

HappyZombies commented Oct 10, 2021

branch v5-dev contains an entire TypeScript version. While this PR is fine, I think we need to be discussing Code Quality first, updating vulnerability packages and also (possibly) tackling what was left on v4. I think after all this THEN we can move to TS.

@orgads
Copy link
Contributor Author

orgads commented Oct 10, 2021

@jankapunkt Why? The Request/Response types accept express input.

@HappyZombies This PR is not about migration to TS. It merely adds the definitions file. This is required for users that use @types/oauth2-server. It's either adding the types here, or adding a new package to DefinitelyTyped.

@jankapunkt
Copy link
Member

@orgads I know they to but not everybody uses express (which is why there are the adapters). Wouldn't the current import force people to install express?

@HappyZombies
Copy link
Member

Not to mention that @types/oauth2-server is from the old/previous module, so things will probably be different once we start adding new features/differences. So it would be incorrect to use @types/oauth2-server since it's not related to this repository/package.

Also, per README -> "The @node-oauth/oauth2-server module is framework-agnostic". Making it the express Request basically means that the module now depends on Express.

@orgads
Copy link
Contributor Author

orgads commented Oct 10, 2021

@jankapunkt Done. Hope it's good enough now.

@HappyZombies This is exactly the reason I want to add the definitions file here, so it will be easier to adapt when making changes.

Generally, changes in a minor version should not break existing APIs, so the definitions file is not expected to change frequently.

@HappyZombies
Copy link
Member

@orgads got it, thanks for explaining, I am not 100% knowledgeable on the whole TypeScript-isms so thanks for being patient with me 😅

@orgads
Copy link
Contributor Author

orgads commented Oct 13, 2021

ping?

@jankapunkt
Copy link
Member

hey @orgads we are still setting this up, there are many things we have to get running first, before we can merge new features or fixes. Please follow on the following PRs:

#18 #32 #29 #30 #35

@HappyZombies HappyZombies added on hold 🛑 We will look into it at a later time typescript 🔢 TypeScript related labels Oct 13, 2021
@orgads
Copy link
Contributor Author

orgads commented Oct 17, 2021

ping

@HappyZombies
Copy link
Member

Branch is still pointing to master, besides we will ping you once ready, so no need to keep bumping us.

@orgads orgads changed the base branch from master to development October 19, 2021 12:38
@orgads
Copy link
Contributor Author

orgads commented Oct 19, 2021

Changed target to development and rebased.

@orgads
Copy link
Contributor Author

orgads commented Nov 1, 2021

Sorry for bothering, but I'm stuck with a vulnerable lodash dependency because of the original oauth2-server package.

Is anything holding you now from merging this and releasing a new version?

@jankapunkt
Copy link
Member

@orgads I activate CI for your PR and you need one more review from either @HappyZombies or @jwerre as I am not the typescript expert

@orgads
Copy link
Contributor Author

orgads commented Nov 4, 2021

Well?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 11, 2021

If you add typings to your package, then you put them into the typings-attribute of package.json and not into the types-attribute.

@orgads
Copy link
Contributor Author

orgads commented Nov 11, 2021

Not according to the docs:

Note that the "typings" field is synonymous with types, and could be used as well.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 11, 2021

yes you are right. I apologize,

@jankapunkt
Copy link
Member

@HappyZombies @jwerre I think this is now worth a second look since we released 4.1.0

Copy link
Collaborator

@Uzlopak Uzlopak left a comment

Choose a reason for hiding this comment

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

I think http.IncomingMessage is the correct Interface.

index.d.ts Outdated Show resolved Hide resolved
@HappyZombies HappyZombies removed the on hold 🛑 We will look into it at a later time label Nov 12, 2021
index.d.ts Show resolved Hide resolved
Copied from DefinitelyTyped.
@jorenvandeweyer
Copy link
Member

This issue is still keeping me from switching to @node-oauth/oauth2-server (and probably many other).

I think this should be merged and released as soon as possible and improved later.

@orgads
Copy link
Contributor Author

orgads commented Nov 23, 2021

I lost my patience and created a forked package with the types: https://www.npmjs.com/package/@audc/oauth2-server

Feel free to use it :)

@HappyZombies
Copy link
Member

I'll try to get this out tomorrow, there were many issues initially so I was a bit sus, but I'm sure they're ironed out now. Sorry about that y'all.

@orgads
Copy link
Contributor Author

orgads commented Nov 23, 2021

Thank you.

@HappyZombies
Copy link
Member

@jwerre mind approving?

@jwerre
Copy link
Contributor

jwerre commented Nov 24, 2021

Ohhh... I'm not much of a Typescripter. I'll approve but not with any confidence.

@jorenvandeweyer
Copy link
Member

jorenvandeweyer commented Nov 24, 2021

Ohhh... I'm not much of a Typescripter. I'll approve but not with any confidence.

I'll verify the types on some existing projects, and update them if necessary.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 24, 2021

@jwerre

I am a typescript user and I think that the types look Ok so far. We can always modify them if the are wrong. In worst case a typescript user would do a // @ts-ignore and report this as a finding.
So nobody should be blocked by the typings and they dont modify active code so no breaking change.

@HappyZombies
Copy link
Member

100% @Uzlopak , any serious issue I have can be fixed later on. Just wanna unblock people looking forward to this

@HappyZombies HappyZombies merged commit 8784aed into node-oauth:development Nov 24, 2021
@jwerre
Copy link
Contributor

jwerre commented Nov 24, 2021

I wonder it we could set up DTSLint in order to test the types?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 24, 2021

Wie could use tsd like fastify does.

I added yesterday a type change to fastify/point-of-view and modified the test.

fastify/point-of-view#272 (comment)

@orgads orgads deleted the types branch November 24, 2021 20:20
@jorenvandeweyer
Copy link
Member

Thanks for merging! Any idea when this will be released?

@HappyZombies
Copy link
Member

I'll try to get it out today or tomorrow

@HappyZombies
Copy link
Member

This has been released on 4.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript 🔢 TypeScript related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants