-
Notifications
You must be signed in to change notification settings - Fork 667
TypeScript Enhancements #1757
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
TypeScript Enhancements #1757
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,7 @@ export const normalizeBuilderImages = ( | |
| ): NormalizedBuilderImages => { | ||
| const builderImageStreams = imageStreams.filter((imageStream) => isBuilder(imageStream)); | ||
|
|
||
| return builderImageStreams.reduce((builderImages, imageStream) => { | ||
| return builderImageStreams.reduce((builderImages: NormalizedBuilderImages, imageStream) => { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this type error appeared after the changes of |
||
| const tags = getBuilderTagsSortedByVersion(imageStream); | ||
| const recentTag = getMostRecentBuilderTag(imageStream); | ||
| const { name } = imageStream.metadata; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,10 +35,12 @@ export type ObjectReference = { | |
| export type ObjectMetadata = { | ||
| name?: string; | ||
| generateName?: string; | ||
| uid?: string; | ||
| annotations?: {[key: string]: string}, | ||
| namespace?: string, | ||
| labels?: {[key: string]: string}, | ||
| ownerReferences?: OwnerReference[], | ||
| deletionTimestamp?: string; | ||
|
||
| [key: string]: any, | ||
| }; | ||
|
|
||
|
|
@@ -81,8 +83,8 @@ export type Toleration = { | |
| }; | ||
|
|
||
| export type K8sResourceKind = { | ||
| apiVersion: string; | ||
| kind: string; | ||
| apiVersion?: string; | ||
|
||
| kind?: string; | ||
| metadata?: ObjectMetadata; | ||
| spec?: { | ||
| selector?: Selector; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the
ts-getdependency due to the performance issues as discussed.I do not like the null checking along the way as proposed because it is easy to make a mistake and is tedious to write for longer paths. So I resolved it with type casting.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both approaches today are error prone. If we turn on
strictNullChecksthen being explicit is a better approach because we benefit from full typechecks._.getwill always be error prone.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we rather wait for
strictNullChecksto be agreed upon and proceed with this? Such a change would certainly affect the whole code base.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't implying we enable
strictNullChecks.I'm fine with using
_.get. It's used everywhere already and it seems others are ok with continuing to use it over a few null checks.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok