File tree Expand file tree Collapse file tree 1 file changed +19
-17
lines changed
Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,10 @@ type GitHubSubject = Omit<
7777 type : SubjectType ;
7878} ;
7979
80+ type StrengthenNullable < T , K extends keyof T , Extra > = Omit < T , K > & {
81+ [ P in K ] : T [ P ] extends null ? null : NonNullable < T [ P ] > & Extra ;
82+ } ;
83+
8084// Exported strengthened types
8185export type Notification = GitHubNotification & GitifyNotification ;
8286
@@ -97,20 +101,18 @@ export type Owner = Omit<
97101 avatar_url : Link ;
98102} ;
99103
100- export type Commit = Omit < BaseCommit , 'author' > & {
101- author : BaseCommit [ 'author' ] extends null
102- ? null
103- : NonNullable < BaseCommit [ 'author' ] > & { type : UserType } ;
104- } ;
105-
106- export type CommitComment = Omit < BaseCommitComment , 'user' > & {
107- user : BaseCommitComment [ 'user' ] extends null
108- ? null
109- : NonNullable < BaseCommitComment [ 'user' ] > & { type : UserType } ;
110- } ;
111-
112- export type Release = Omit < BaseRelease , 'author' > & {
113- author : BaseRelease [ 'author' ] extends null
114- ? null
115- : NonNullable < BaseRelease [ 'author' ] > & { type : UserType } ;
116- } ;
104+ export type Commit = StrengthenNullable <
105+ BaseCommit ,
106+ 'author' ,
107+ { type : UserType }
108+ > ;
109+ export type CommitComment = StrengthenNullable <
110+ BaseCommitComment ,
111+ 'user' ,
112+ { type : UserType }
113+ > ;
114+ export type Release = StrengthenNullable <
115+ BaseRelease ,
116+ 'author' ,
117+ { type : UserType }
118+ > ;
You can’t perform that action at this time.
0 commit comments