sergiodxa / remix-auth-github

A GitHubStrategy for Remix Auth, based on the OAuth2Strategy
https://sergiodxa.github.io/remix-auth-github/
MIT License
75 stars 17 forks source link

Exclude `undefined` from `GitHubEmails` type #11

Closed haines closed 1 year ago

haines commented 2 years ago

emails is optional in OAuth2Profile, so OAuth2Profile["emails"] returns Array<{ ... }> | undefined.

This causes a compilation error when the compiler option exactOptionalPropertyTypes is set.

node_modules/remix-auth-github/build/index.d.ts(15,18): error TS2430: Interface 'GitHubProfile' incorrectly extends interface 'OAuth2Profile'.
  Types of property 'emails' are incompatible.
    Type '{ value: string; type?: string; }[] | undefined' is not assignable to type '{ value: string; type?: string; }[]'.
      Type 'undefined' is not assignable to type '{ value: string; type?: string; }[]'.

emails is always set, so I think it makes sense to remove the possibility of undefined from the type.

haines commented 1 year ago

@sergiodxa could you please take a look?