Unverified Commit 4794dfb3 authored by Dorian Johnson's avatar Dorian Johnson Committed by GitHub

chore: Various typing fixes (#754)

Signed-off-by: 's avatarMarcos Iglesias Valle <golodhros@gmail.com>
parent 37ee7640
// BETTERER RESULTS V2.
exports[`strict null compilation`] = {
value: `{
"js/components/NavBar/index.spec.tsx:4130335159": [
[53, 54, 8, "Argument of type \'Partial<Location<{} | null | undefined>> | undefined\' is not assignable to parameter of type \'Partial<Location<{} | null | undefined>>\'.\\n Type \'undefined\' is not assignable to type \'Partial<Location<{} | null | undefined>>\'.", "2700611480"],
[99, 39, 4, "Argument of type \'null\' is not assignable to parameter of type \'Partial<NavBarProps> | undefined\'.", "2087897566"],
[100, 32, 36, "No overload matches this call.\\n Overload 1 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 2 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 3 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.", "788521834"],
[110, 39, 4, "Argument of type \'null\' is not assignable to parameter of type \'Partial<NavBarProps> | undefined\'.", "2087897566"]
],
"js/components/common/Bookmark/MyBookmarks/index.tsx:3695929904": [
[66, 6, 7, "Type \'Element | null\' is not assignable to type \'Element | undefined\'.\\n Type \'null\' is not assignable to type \'Element | undefined\'.", "3716929964"],
[73, 8, 7, "Type \'Element | null\' is not assignable to type \'Element | undefined\'.\\n Type \'null\' is not assignable to type \'Element | undefined\'.", "3716929964"]
......@@ -17,30 +11,13 @@ exports[`strict null compilation`] = {
"js/components/common/EditableSection/index.spec.tsx:1117078860": [
[93, 32, 4, "Argument of type \'null\' is not assignable to parameter of type \'Partial<EditableSectionProps> | undefined\'.", "2087897566"]
],
"js/components/common/Flag/index.tsx:814006609": [
[26, 27, 8, "Argument of type \'CaseType | null\' is not assignable to parameter of type \'CaseType\'.\\n Type \'null\' is not assignable to type \'CaseType\'.", "4036080041"]
],
"js/components/common/OwnerEditor/index.spec.tsx:3994734501": [
[21, 6, 9, "Type \'null\' is not assignable to type \'boolean | undefined\'.", "1517648899"],
[24, 6, 8, "Type \'null\' is not assignable to type \'boolean | undefined\'.", "2673870115"]
],
"js/components/common/OwnerEditor/index.tsx:459308532": [
[147, 12, 5, "Property \'value\' does not exist on type \'HTMLInputElement | null\'.", "189936718"]
],
"js/components/common/ResourceListItem/DashboardListItem/index.spec.tsx:53357032": [
[163, 14, 29, "Type \'null\' is not assignable to type \'number\'.", "1157138603"]
],
"js/components/common/ScrollTracker/index.tsx:727804392": [
[55, 30, 29, "Argument of type \'number | undefined\' is not assignable to parameter of type \'number\'.\\n Type \'undefined\' is not assignable to type \'number\'.", "745919071"]
],
"js/components/common/SearchBar/InlineSearchResults/SearchItemList/SearchItem/tests/index.spec.tsx:3109268054": [
[62, 30, 36, "No overload matches this call.\\n Overload 1 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 2 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 3 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.", "4042031348"]
],
"js/components/common/SearchBar/InlineSearchResults/tests/index.spec.tsx:2224470971": [
[51, 13, 56, "Conversion of type \'{ page_index: number; results: { display_name: string; email: string; employee_type: null; first_name: string; full_name: string; github_username: string; is_active: boolean; last_name: string; ... 7 more ...; user_id: string; }[]; total_results: number; }\' to type \'SearchResults<UserResource>\' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to \'unknown\' first.\\n Types of property \'results\' are incompatible.\\n Type \'{ display_name: string; email: string; employee_type: null; first_name: string; full_name: string; github_username: string; is_active: boolean; last_name: string; manager_email: string; manager_fullname: string; ... 5 more ...; user_id: string; }[]\' is not comparable to type \'UserResource[]\'.\\n Type \'{ display_name: string; email: string; employee_type: null; first_name: string; full_name: string; github_username: string; is_active: boolean; last_name: string; manager_email: string; manager_fullname: string; ... 5 more ...; user_id: string; }\' is not comparable to type \'UserResource\'.\\n Types of property \'employee_type\' are incompatible.\\n Type \'null\' is not comparable to type \'string\'.", "3811500358"]
],
"js/components/common/SearchBar/index.spec.tsx:2504836695": [
[30, 54, 8, "Argument of type \'Partial<Location<{} | null | undefined>> | undefined\' is not assignable to parameter of type \'Partial<Location<{} | null | undefined>>\'.\\n Type \'undefined\' is not assignable to type \'Partial<Location<{} | null | undefined>>\'.", "2700611480"],
[403, 30, 4, "Argument of type \'null\' is not assignable to parameter of type \'Partial<SearchBarProps> | undefined\'.", "2087897566"]
],
"js/components/common/SearchBar/index.tsx:4158354159": [
......@@ -67,12 +44,6 @@ exports[`strict null compilation`] = {
[49, 8, 10, "Type \'null\' is not assignable to type \'number\'.", "3382497788"],
[62, 8, 5, "Type \'AnnouncementPost[] | undefined\' is not assignable to type \'AnnouncementPost[]\'.\\n Type \'undefined\' is not assignable to type \'AnnouncementPost[]\'.", "187752366"]
],
"js/ducks/bookmark/reducer.ts:1596344454": [
[126, 21, 38, "Object is possibly \'undefined\'.", "2378953250"],
[139, 26, 45, "Object is possibly \'undefined\'.", "2845005480"],
[143, 14, 11, "Property \'resourceKey\' does not exist on type \'{ resourceKey: string; resourceType: ResourceType; } | undefined\'.", "2431704504"],
[143, 27, 12, "Property \'resourceType\' does not exist on type \'{ resourceKey: string; resourceType: ResourceType; } | undefined\'.", "2937713623"]
],
"js/ducks/dashboard/reducer.ts:1902488284": [
[71, 2, 10, "Type \'null\' is not assignable to type \'number\'.", "3382497788"],
[83, 8, 10, "Type \'null\' is not assignable to type \'number\'.", "3382497788"]
......@@ -105,39 +76,18 @@ exports[`strict null compilation`] = {
"js/ducks/notification/tests/index.spec.ts:2474130513": [
[197, 43, 4, "Argument of type \'null\' is not assignable to parameter of type \'SubmitNotificationRequest\'.", "2087897566"]
],
"js/ducks/search/reducer.ts:2164504857": [
[69, 6, 8, "Type \'ResourceType | undefined\' is not assignable to type \'ResourceType\'.\\n Type \'undefined\' is not assignable to type \'ResourceType\'.", "2131237679"],
[70, 6, 9, "Type \'number | undefined\' is not assignable to type \'number\'.\\n Type \'undefined\' is not assignable to type \'number\'.", "2382523144"],
[321, 22, 8, "Object is possibly \'undefined\'.", "285083598"],
[322, 18, 8, "Object is possibly \'undefined\'.", "285083598"],
[323, 17, 8, "Object is possibly \'undefined\'.", "285083598"],
[359, 22, 13, "Object is possibly \'undefined\'.", "1305766902"],
[360, 18, 13, "Object is possibly \'undefined\'.", "1305766902"],
[361, 17, 13, "Object is possibly \'undefined\'.", "1305766902"]
],
"js/ducks/search/sagas.ts:2952790030": [
[114, 10, 7, "Property \'filters\' does not exist on type \'UpdateSearchStatePayload | undefined\'.", "1789297334"],
[114, 19, 8, "Property \'resource\' does not exist on type \'UpdateSearchStatePayload | undefined\'.", "2131237679"],
[114, 29, 9, "Property \'updateUrl\' does not exist on type \'UpdateSearchStatePayload | undefined\'.", "3222485055"],
[114, 40, 12, "Property \'submitSearch\' does not exist on type \'UpdateSearchStatePayload | undefined\'.", "30183583"]
],
"js/ducks/search/utils.ts:1054027285": [
[22, 13, 12, "Object is possibly \'undefined\'.", "589203217"],
[24, 13, 11, "Object is possibly \'undefined\'.", "668071166"],
[26, 13, 16, "Object is possibly \'undefined\'.", "3205469291"]
],
"js/ducks/tableMetadata/api/helpers.spec.ts:3775424408": [
[184, 44, 8, "Argument of type \'{ display_name: null; email: string; employee_type: string; first_name: string; full_name: string; github_username: string; is_active: boolean; last_name: string; manager_email?: string | undefined; ... 5 more ...; user_id: string; }\' is not assignable to parameter of type \'PeopleUser\'.\\n Types of property \'display_name\' are incompatible.\\n Type \'null\' is not assignable to type \'string\'.", "3765169026"]
"js/ducks/search/sagas.ts:1595931651": [
[68, 6, 9, "Argument of type \'undefined\' is not assignable to parameter of type \'ResourceType\'.", "2620553983"],
[118, 49, 9, "Argument of type \'undefined\' is not assignable to parameter of type \'ResourceType\'.", "2620553983"]
],
"js/ducks/search/tests/sagas.spec.ts:143749331": [
[155, 53, 9, "Argument of type \'undefined\' is not assignable to parameter of type \'ResourceType\'.", "2620553983"],
[166, 50, 9, "Argument of type \'undefined\' is not assignable to parameter of type \'ResourceType\'.", "2620553983"],
[287, 46, 9, "Argument of type \'undefined\' is not assignable to parameter of type \'ResourceType\'.", "2620553983"]
],
"js/ducks/tableMetadata/api/v0.ts:1644381619": [
[137, 24, 7, "Argument of type \'Promise<AxiosResponse<any> | undefined>\' is not assignable to parameter of type \'never\'.", "1363914868"]
],
"js/ducks/tableMetadata/index.spec.ts:535377148": [
[485, 66, 4, "Argument of type \'null\' is not assignable to parameter of type \'(() => any) | undefined\'.", "2087897566"],
[512, 53, 4, "Argument of type \'null\' is not assignable to parameter of type \'(() => any) | undefined\'.", "2087897566"],
[625, 16, 4, "Argument of type \'null\' is not assignable to parameter of type \'(() => any) | undefined\'.", "2087897566"],
[657, 16, 4, "Argument of type \'null\' is not assignable to parameter of type \'(() => any) | undefined\'.", "2087897566"]
],
"js/ducks/tableMetadata/reducer.ts:2668005658": [
[65, 2, 10, "Type \'null\' is not assignable to type \'number\'.", "3382497788"]
],
......@@ -153,27 +103,8 @@ exports[`strict null compilation`] = {
"js/ducks/utilMethods.ts:3713570825": [
[52, 4, 5, "Type \'string | null\' is not assignable to type \'string | undefined\'.\\n Type \'null\' is not assignable to type \'string | undefined\'.", "173467459"]
],
"js/fixtures/globalState.ts:3931474038": [
[69, 4, 12, "Type \'null\' is not assignable to type \'string\'.", "124336133"]
],
"js/fixtures/mockRouter.ts:3563515077": [
[30, 6, 4, "Type \'null\' is not assignable to type \'{ (path: string, state?: {} | null | undefined): void; (location: LocationDescriptorObject<{} | null | undefined>): void; }\'.", "2088074939"],
[31, 6, 7, "Type \'null\' is not assignable to type \'{ (path: string, state?: {} | null | undefined): void; (location: LocationDescriptorObject<{} | null | undefined>): void; }\'.", "1364993353"],
[32, 6, 2, "Type \'null\' is not assignable to type \'(n: number) => void\'.", "5860973"],
[33, 6, 6, "Type \'null\' is not assignable to type \'() => void\'.", "1396285030"],
[34, 6, 9, "Type \'null\' is not assignable to type \'() => void\'.", "3244819094"],
[35, 6, 5, "Type \'null\' is not assignable to type \'(prompt?: string | boolean | TransitionPromptHook<{} | null | undefined> | undefined) => UnregisterCallback\'.", "175793644"],
[36, 6, 10, "Type \'null\' is not assignable to type \'(location: LocationDescriptorObject<{} | null | undefined>) => string\'.", "1487278680"],
[37, 6, 6, "Type \'null\' is not assignable to type \'(listener: LocationListener<{} | null | undefined>) => UnregisterCallback\'.", "1420496588"]
],
"js/pages/DashboardPage/DashboardOwnerEditor/index.spec.tsx:4125678807": [
[29, 19, 11, "Type \'{ manager_id: null; manager_fullname: null; manager_email: null; profile_url: string; role_name: null; display_name: null; github_username: null; team_name: null; last_name: null; full_name: null; ... 6 more ...; user_id: string; }\' is not assignable to type \'User\'.\\n Types of property \'display_name\' are incompatible.\\n Type \'null\' is not assignable to type \'string\'.", "2041815528"]
],
"js/pages/DashboardPage/index.spec.tsx:3811826221": [
[53, 4, 8, "Argument of type \'Partial<Location<{} | null | undefined>> | undefined\' is not assignable to parameter of type \'Partial<Location<{} | null | undefined>>\'.\\n Type \'undefined\' is not assignable to type \'Partial<Location<{} | null | undefined>>\'.", "2700611480"]
],
"js/pages/ProfilePage/index.spec.tsx:4086464143": [
[41, 6, 4, "Argument of type \'null\' is not assignable to parameter of type \'Partial<Location<{} | null | undefined>>\'.", "2087897566"]
[41, 6, 4, "Argument of type \'null\' is not assignable to parameter of type \'Partial<Location<{} | null | undefined>> | undefined\'.", "2087897566"]
],
"js/pages/ProfilePage/index.tsx:1225704099": [
[356, 2, 15, "No overload matches this call.\\n The last overload gave the following error.\\n Argument of type \'(state: GlobalState) => { user: PeopleUser; resourceRelations: { table: { bookmarks: Bookmark[]; own: Resource[]; read: Resource[]; }; dashboard: { bookmarks: Bookmark[] | undefined; own: Resource[] | undefined; read: never[]; }; }; }\' is not assignable to parameter of type \'MapStateToPropsParam<StateFromProps, {}, {}>\'.\\n Type \'(state: GlobalState) => { user: PeopleUser; resourceRelations: { table: { bookmarks: Bookmark[]; own: Resource[]; read: Resource[]; }; dashboard: { bookmarks: Bookmark[] | undefined; own: Resource[] | undefined; read: never[]; }; }; }\' is not assignable to type \'MapStateToPropsFactory<StateFromProps, {}, {}>\'.\\n Type \'{ user: PeopleUser; resourceRelations: { table: { bookmarks: Bookmark[]; own: Resource[]; read: Resource[]; }; dashboard: { bookmarks: Bookmark[] | undefined; own: Resource[] | undefined; read: never[]; }; }; }\' is not assignable to type \'MapStateToProps<StateFromProps, {}, {}>\'.\\n Type \'{ user: PeopleUser; resourceRelations: { table: { bookmarks: Bookmark[]; own: Resource[]; read: Resource[]; }; dashboard: { bookmarks: Bookmark[] | undefined; own: Resource[] | undefined; read: never[]; }; }; }\' provides no match for the signature \'(state: {}, ownProps: {}): StateFromProps\'.", "1389821531"]
......@@ -189,15 +120,6 @@ exports[`strict null compilation`] = {
[86, 26, 7, "Argument of type \'{ categoryId: string; helpText: string | undefined; title: string; type: FilterType; }\' is not assignable to parameter of type \'never\'.", "2519086860"],
[95, 56, 4, "No overload matches this call.\\n The last overload gave the following error.\\n Argument of type \'null\' is not assignable to parameter of type \'{}\'.", "2087897566"]
],
"js/pages/SearchPage/index.spec.tsx:2996104118": [
[45, 52, 8, "Argument of type \'Partial<Location<{} | null | undefined>> | undefined\' is not assignable to parameter of type \'Partial<Location<{} | null | undefined>>\'.\\n Type \'undefined\' is not assignable to type \'Partial<Location<{} | null | undefined>>\'.", "2700611480"],
[69, 34, 4, "Argument of type \'null\' is not assignable to parameter of type \'Partial<SearchPageProps> | undefined\'.", "2087897566"],
[86, 34, 4, "Argument of type \'null\' is not assignable to parameter of type \'Partial<SearchPageProps> | undefined\'.", "2087897566"],
[269, 14, 40, "No overload matches this call.\\n Overload 1 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 2 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 3 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.", "1257093057"],
[281, 14, 40, "No overload matches this call.\\n Overload 1 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 2 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 3 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.", "1257093057"],
[293, 14, 40, "No overload matches this call.\\n Overload 1 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 2 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Overload 3 of 3, \'(node: ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>, options?: ShallowRendererProps | undefined): ShallowWrapper<...>\', gave the following error.\\n Argument of type \'Element | null\' is not assignable to parameter of type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.\\n Type \'null\' is not assignable to type \'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>\'.", "1257093057"],
[302, 8, 8, "Type \'null\' is not assignable to type \'ResourceType | undefined\'.", "2131237679"]
],
"js/pages/SearchPage/index.tsx:3158270092": [
[176, 11, 12, "Property \'filterSections\' is missing in type \'{}\' but required in type \'Readonly<Pick<StateFromProps, \\"filterSections\\">>\'.", "250899467"]
],
......@@ -208,25 +130,16 @@ exports[`strict null compilation`] = {
"js/pages/TableDetailPage/TableDashboardResourceList/index.tsx:3276822301": [
[65, 2, 15, "No overload matches this call.\\n The last overload gave the following error.\\n Argument of type \'(state: GlobalState) => { dashboards: DashboardResource[]; isLoading: boolean; errorText: string | undefined; }\' is not assignable to parameter of type \'MapStateToPropsParam<StateFromProps, OwnProps, {}>\'.\\n Type \'(state: GlobalState) => { dashboards: DashboardResource[]; isLoading: boolean; errorText: string | undefined; }\' is not assignable to type \'MapStateToPropsFactory<StateFromProps, OwnProps, {}>\'.\\n Type \'{ dashboards: DashboardResource[]; isLoading: boolean; errorText: string | undefined; }\' is not assignable to type \'MapStateToProps<StateFromProps, OwnProps, {}>\'.\\n Type \'{ dashboards: DashboardResource[]; isLoading: boolean; errorText: string | undefined; }\' provides no match for the signature \'(state: {}, ownProps: OwnProps): StateFromProps\'.", "1389821531"]
],
"js/pages/TableDetailPage/TableOwnerEditor/index.spec.tsx:3400494524": [
[28, 10, 6, "Type \'{ [x: string]: { manager_id: null; manager_fullname: null; manager_email: null; profile_url: string; role_name: null; display_name: null; github_username: null; team_name: null; last_name: null; full_name: null; ... 6 more ...; user_id: string; }; }\' is not assignable to type \'OwnerDict\'.\\n Index signatures are incompatible.\\n Type \'{ manager_id: null; manager_fullname: null; manager_email: null; profile_url: string; role_name: null; display_name: null; github_username: null; team_name: null; last_name: null; full_name: null; ... 6 more ...; user_id: string; }\' is not assignable to type \'User\'.", "1719502071"]
],
"js/pages/TableDetailPage/WatermarkLabel/index.spec.tsx:1587893154": [
[77, 57, 4, "Argument of type \'null\' is not assignable to parameter of type \'string\'.", "2087897566"]
],
"js/pages/TableDetailPage/WatermarkLabel/index.tsx:1354016727": [
[80, 34, 3, "Argument of type \'string | null\' is not assignable to parameter of type \'string\'.\\n Type \'null\' is not assignable to type \'string\'.", "193412913"]
],
"js/pages/TableDetailPage/index.spec.tsx:120018363": [
[33, 4, 8, "Argument of type \'Partial<Location<{} | null | undefined>> | undefined\' is not assignable to parameter of type \'Partial<Location<{} | null | undefined>>\'.\\n Type \'undefined\' is not assignable to type \'Partial<Location<{} | null | undefined>>\'.", "2700611480"]
],
"js/pages/TableDetailPage/index.tsx:3727993506": [
[185, 10, 13, "Type \'null\' is not assignable to type \'((newValue: string, onSuccess?: (() => any) | undefined, onFailure?: (() => any) | undefined) => void) | undefined\'.", "67794331"],
[240, 11, 26, "Type \'{ itemsPerPage: number; source: string; }\' is missing the following properties from type \'Readonly<Pick<TableDashboardResourceListProps, \\"source\\" | \\"isLoading\\" | \\"dashboards\\" | \\"itemsPerPage\\" | \\"errorText\\"> & OwnProps>\': isLoading, dashboards, errorText", "2224258167"],
[329, 16, 7, "Type \'string | null\' is not assignable to type \'string | undefined\'.\\n Type \'null\' is not assignable to type \'string | undefined\'.", "3817619378"]
],
"webpack.common.ts:1615757453": [
[42, 24, 20, "No overload matches this call.\\n Overload 1 of 2, \'(...items: ConcatArray<never>[]): never[]\', gave the following error.\\n Argument of type \'string\' is not assignable to parameter of type \'ConcatArray<never>\'.\\n Overload 2 of 2, \'(...items: ConcatArray<never>[]): never[]\', gave the following error.\\n Argument of type \'string\' is not assignable to parameter of type \'ConcatArray<never>\'.", "806093104"]
]
}`
};
......@@ -97,10 +97,12 @@ describe('NavBar', () => {
describe('renderSearchBar', () => {
it('returns small SearchBar when not on home page', () => {
const { props, wrapper } = setup(null, { pathname: '/search' });
const searchBar = shallow(wrapper.instance().renderSearchBar()).find(
SearchBar
);
const { props, wrapper } = setup(undefined, { pathname: '/search' });
const rendered = wrapper.instance().renderSearchBar();
if (rendered === null) {
throw Error('rendering search bar returned null');
}
const searchBar = shallow(rendered).find(SearchBar);
expect(searchBar.exists()).toBe(true);
expect(searchBar.props()).toMatchObject({
size: 'small',
......@@ -108,7 +110,7 @@ describe('NavBar', () => {
});
it('returns null if conditions to render search bar are not met', () => {
const { props, wrapper } = setup(null, { pathname: '/' });
const { props, wrapper } = setup(undefined, { pathname: '/' });
expect(wrapper.instance().renderSearchBar()).toBe(null);
});
});
......
......@@ -19,10 +19,10 @@ describe('OwnerEditor', () => {
errorText: null,
isLoading: false,
itemProps: {},
isEditing: null,
isEditing: undefined,
setEditMode: jest.fn(),
onUpdateList: jest.fn(),
readOnly: null,
readOnly: undefined,
resourceType: ResourceType.table,
...propOverrides,
};
......
......@@ -145,9 +145,10 @@ export class OwnerEditor extends React.Component<
recordAddItem = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (this.inputRef.current) {
const { value } = this.inputRef.current;
if (this.inputRef.current && value) {
if (value) {
this.inputRef.current.value = '';
const newTempItemProps = {
......@@ -156,6 +157,7 @@ export class OwnerEditor extends React.Component<
};
this.setState({ tempItemProps: newTempItemProps });
}
}
};
recordDeleteItem = (deletedKey: string) => {
......
......@@ -60,8 +60,11 @@ describe('SearchItem', () => {
it('renders correct text if !props.hasResults', () => {
const { wrapper } = setup({ hasResults: false });
const content = shallow(wrapper.instance().renderIndicator());
expect(content.text()).toBe(SEARCH_ITEM_NO_RESULTS);
const rendered = wrapper.instance().renderIndicator();
if (rendered === null) {
throw Error('renderIndicator returned null');
}
expect(shallow(rendered).text()).toBe(SEARCH_ITEM_NO_RESULTS);
});
it('renders nothing if !props.Loading and props.hasResults', () => {
......
......@@ -121,12 +121,17 @@ export default function reducer(
): BookmarkReducerState {
switch (action.type) {
case AddBookmark.SUCCESS:
case GetBookmarks.SUCCESS:
case GetBookmarks.SUCCESS: {
const { payload } = <GetBookmarksResponse>action;
if (payload === undefined) {
throw Error('payload must be set for GetBookmarks.SUCCESS');
}
return {
...state,
myBookmarks: (<GetBookmarksResponse>action).payload.bookmarks,
myBookmarks: payload.bookmarks,
myBookmarksIsLoaded: true,
};
}
case GetBookmarksForUser.REQUEST:
return {
...state,
......@@ -134,16 +139,23 @@ export default function reducer(
...initialBookmarkState,
},
};
case GetBookmarksForUser.SUCCESS:
case GetBookmarksForUser.SUCCESS: {
const { payload } = <GetBookmarksForUserResponse>action;
if (payload === undefined) {
throw Error('payload must be set for GetBookmarksForUser.SUCCESS');
}
return {
...state,
bookmarksForUser: (<GetBookmarksForUserResponse>action).payload
.bookmarks,
bookmarksForUser: payload.bookmarks,
};
case RemoveBookmark.SUCCESS:
const { resourceKey, resourceType } = (<RemoveBookmarkResponse>(
action
)).payload;
}
case RemoveBookmark.SUCCESS: {
const { payload } = <RemoveBookmarkResponse>action;
if (payload === undefined) {
throw Error('payload must be set for RemoveBookmark.SUCCESS');
}
const { resourceKey, resourceType } = payload;
return {
...state,
myBookmarks: {
......@@ -153,6 +165,7 @@ export default function reducer(
),
},
};
}
case AddBookmark.FAILURE:
case GetBookmarks.FAILURE:
case GetBookmarksForUser.FAILURE:
......
......@@ -61,8 +61,8 @@ export interface SearchReducerState {
export function searchAll(
searchType: SearchType,
term: string,
resource?: ResourceType,
pageIndex?: number,
resource: ResourceType,
pageIndex: number,
useFilters: boolean = false
): SearchAllRequest {
return {
......@@ -314,6 +314,11 @@ export default function reducer(
case SearchAll.SUCCESS:
// resets all resources with initial state then applies search results
const newState = (<SearchAllResponse>action).payload;
if (newState === undefined) {
throw Error(
'SearchAllResponse.payload must be specified for SUCCESS type'
);
}
return {
...initialState,
...newState,
......@@ -354,6 +359,11 @@ export default function reducer(
};
case InlineSearch.SUCCESS:
const inlineResults = (<InlineSearchResponse>action).payload;
if (inlineResults === undefined) {
throw Error(
'InlineSearchResponse.payload must be specified for SUCCESS type'
);
}
return {
...state,
inlineResults: {
......
......@@ -112,6 +112,7 @@ export function* submitSearchResourceWatcher(): SagaIterator {
export function* updateSearchStateWorker(
action: UpdateSearchStateRequest
): SagaIterator {
if (action.payload !== undefined) {
const { filters, resource, updateUrl, submitSearch } = action.payload;
const state = yield select(getSearchState);
if (filters && submitSearch) {
......@@ -124,6 +125,7 @@ export function* updateSearchStateWorker(
filters: filters || state.filters,
});
}
}
}
export function* updateSearchStateWatcher(): SagaIterator {
yield takeEvery(UpdateSearchState.REQUEST, updateSearchStateWorker);
......
......@@ -20,11 +20,11 @@ export const getPageIndex = (
resource = resource || state.resource;
switch (resource) {
case ResourceType.table:
return state.tables.page_index;
return state.tables?.page_index || 0;
case ResourceType.user:
return state.users.page_index;
return state.users?.page_index || 0;
case ResourceType.dashboard:
return state.dashboards.page_index;
return state.dashboards?.page_index || 0;
}
return 0;
};
......
......@@ -180,7 +180,7 @@ describe('helpers', () => {
it('returns false if not a user with display_name', () => {
const testUser = {
...globalState.user.loggedInUser,
display_name: null,
display_name: '',
};
expect(Helpers.shouldSendNotification(testUser)).toBe(false);
});
......
......@@ -483,7 +483,7 @@ describe('tableMetadata ducks', () => {
sagaTest = (mockSuccess) => {
return testSaga(
updateTableDescriptionWorker,
updateTableDescription(newDescription, mockSuccess, null)
updateTableDescription(newDescription, mockSuccess, undefined)
)
.next()
.select()
......@@ -510,7 +510,7 @@ describe('tableMetadata ducks', () => {
sagaTest = (mockFailure) => {
return testSaga(
updateTableDescriptionWorker,
updateTableDescription(newDescription, null, mockFailure)
updateTableDescription(newDescription, undefined, mockFailure)
)
.next()
.select()
......@@ -623,7 +623,7 @@ describe('tableMetadata ducks', () => {
newDescription,
columnIndex,
mockSuccess,
null
undefined
)
)
.next()
......@@ -655,7 +655,7 @@ describe('tableMetadata ducks', () => {
updateColumnDescription(
newDescription,
columnIndex,
null,
undefined,
mockFailure
)
)
......
......@@ -67,7 +67,7 @@ const globalState: GlobalState = {
},
issue: {
issues: [],
allIssuesUrl: null,
allIssuesUrl: '',
total: 0,
isLoading: true,
},
......
export const activeUser0 = {
manager_id: null,
manager_fullname: null,
manager_email: null,
import { PeopleUser } from 'interfaces/User';
export const activeUser0: PeopleUser = {
manager_fullname: undefined,
manager_email: undefined,
profile_url: '/test0',
role_name: null,
display_name: null,
github_username: null,
team_name: null,
last_name: null,
full_name: null,
slack_id: null,
first_name: null,
employee_type: null,
other_key_values: {},
role_name: undefined,
display_name: '',
github_username: '',
team_name: '',
last_name: '',
full_name: '',
slack_id: '',
first_name: '',
employee_type: '',
is_active: true,
email: 'user0@test.com',
user_id: 'user0',
};
export const activeUser1 = {
manager_id: null,
manager_fullname: null,
manager_email: null,
export const activeUser1: PeopleUser = {
manager_fullname: undefined,
manager_email: undefined,
profile_url: '/test1',
role_name: null,
display_name: null,
github_username: null,
team_name: null,
last_name: null,
full_name: null,
slack_id: null,
first_name: null,
employee_type: null,
other_key_values: {},
role_name: undefined,
display_name: '',
github_username: '',
team_name: '',
last_name: '',
full_name: '',
slack_id: '',
first_name: '',
employee_type: '',
is_active: true,
email: 'user10@test.com',
user_id: 'user1',
......
......@@ -5,7 +5,7 @@ import * as History from 'history';
// Mock React-Router
export function getMockRouterProps<P>(
data: P,
location: Partial<History.Location>
location: Partial<History.Location> = {}
): RouteComponentProps<P> {
const mockLocation: History.Location = {
hash: '',
......@@ -24,7 +24,10 @@ export function getMockRouterProps<P>(
url: '',
},
location: mockLocation,
history: {
// This history object is a mock and `null`s many of the required methods. The
// tests are designed not to trigger them, if they do, an error is expected.
// So cast this as any.
history: <any>{
length: 2,
action: 'POP',
location: mockLocation,
......
......@@ -99,7 +99,7 @@ export const allResourcesExample = {
{
display_name: 'Test User',
email: 'tuser@test.com',
employee_type: null,
employee_type: '',
first_name: 'Test',
full_name: 'Test User',
github_username: '',
......@@ -108,8 +108,8 @@ export const allResourcesExample = {
manager_email: 'tuser2@test.com',
manager_fullname: 'Test User2',
profile_url: '',
role_name: null,
slack_id: null,
role_name: undefined,
slack_id: '',
team_name: 'Amundsen Team',
type: 'user',
user_id: 'tuser@test.com',
......@@ -117,7 +117,7 @@ export const allResourcesExample = {
{
display_name: 'Test User2',
email: 'tuser2@test.com',
employee_type: null,
employee_type: '',
first_name: 'Test',
full_name: 'Test User2',
github_username: '',
......@@ -126,8 +126,8 @@ export const allResourcesExample = {
manager_email: 'tuser3@test.com',
manager_fullname: 'Test User3',
profile_url: '',
role_name: null,
slack_id: null,
role_name: undefined,
slack_id: '',
team_name: 'Amundsen Team',
type: 'user',
user_id: 'tuser2@test.com',
......
......@@ -67,7 +67,7 @@ describe('SearchPage', () => {
let wrapper;
beforeAll(() => {
({ props, wrapper } = setup(null, {
({ props, wrapper } = setup(undefined, {
search: '/search?searchTerm=testName&resource=table&pageIndex=1',
}));
});
......@@ -84,7 +84,7 @@ describe('SearchPage', () => {
let mockPrevProps;
beforeAll(() => {
({ props, wrapper } = setup(null, {
({ props, wrapper } = setup(undefined, {
search: '/search?searchTerm=testName&resource=table&pageIndex=1',
}));
mockPrevProps = {
......@@ -267,7 +267,11 @@ describe('SearchPage', () => {
resource: ResourceType.table,
});
const getTabContentSpy = jest.spyOn(wrapper.instance(), 'getTabContent');
shallow(wrapper.instance().renderSearchResults());
const rendered = wrapper.instance().renderSearchResults();
if (rendered === null) {
throw Error('renderSearchResults returned null');
}
shallow(rendered);
expect(getTabContentSpy).toHaveBeenCalledWith(
props.tables,
ResourceType.table
......@@ -279,7 +283,11 @@ describe('SearchPage', () => {
resource: ResourceType.user,
});
const getTabContentSpy = jest.spyOn(wrapper.instance(), 'getTabContent');
shallow(wrapper.instance().renderSearchResults());
const rendered = wrapper.instance().renderSearchResults();
if (rendered === null) {
throw Error('renderSearchResults returned null');
}
shallow(rendered);
expect(getTabContentSpy).toHaveBeenCalledWith(
props.users,
ResourceType.user
......@@ -291,7 +299,11 @@ describe('SearchPage', () => {
resource: ResourceType.dashboard,
});
const getTabContentSpy = jest.spyOn(wrapper.instance(), 'getTabContent');
shallow(wrapper.instance().renderSearchResults());
const rendered = wrapper.instance().renderSearchResults();
if (rendered === null) {
throw Error('renderSearchResults returned null');
}
shallow(rendered);
expect(getTabContentSpy).toHaveBeenCalledWith(
props.dashboards,
ResourceType.dashboard
......@@ -300,7 +312,7 @@ describe('SearchPage', () => {
it('renders null for an invalid resource', () => {
const { wrapper } = setup({
resource: null,
resource: undefined,
});
const renderedSearchResults = wrapper.instance().renderSearchResults();
expect(renderedSearchResults).toBe(null);
......
......@@ -8,7 +8,7 @@ export enum CaseType {
TITLE_CASE = 'titleCase',
}
export function convertText(str = '', caseType: CaseType): string {
export function convertText(str = '', caseType: CaseType | null): string {
switch (caseType) {
case CaseType.LOWER_CASE:
return str.toLowerCase();
......
......@@ -36,7 +36,7 @@ const PATHS = {
};
// Process of Templates
const walkSync = (dir, filelist = []) => {
const walkSync = (dir: string, filelist: string[] = []) => {
fs.readdirSync(dir).forEach((file) => {
filelist = fs.statSync(path.join(dir, file)).isDirectory()
? walkSync(path.join(dir, file), filelist)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment