This repo contains the Claim Status Tracker app, which helps Californians better understand what’s happening with their unemployment claim and benefits.
Correct the typing errors in the indexServerSide test. Due to the interaction between NextJS & Jest the typing is reporting issues, and due to how the context object is updated via the call, we cannot cast it to unknown.
Discovered & spun out of #571
$ yarn typecheck
$ tsc -p .
tests/pages/indexServerSide.test.ts:30:11 - error TS2322: Type 'GetServerSidePropsResult<{ [key: string]: any; }>' is not assignable to type 'GetServerSideProps<{ [key: string]: any; }, ParsedUrlQuery>'.
Type '{ redirect: Redirect; }' is not assignable to type 'GetServerSideProps<{ [key: string]: any; }, ParsedUrlQuery>'.
Type '{ redirect: Redirect; }' provides no match for the signature '(context: GetServerSidePropsContext<ParsedUrlQuery>): Promise<GetServerSidePropsResult<{ [key: string]: any; }>>'.
30 const result: GetServerSideProps = await getServerSideProps(context as GetServerSidePropsContext)
~~~~~~
tests/pages/indexServerSide.test.ts:30:65 - error TS2352: Conversion of type '{ req: { headers: {}; }; res: { statusCode: null; }; }' to type 'GetServerSidePropsContext<ParsedUrlQuery>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Type '{ req: { headers: {}; }; res: { statusCode: null; }; }' is missing the following properties from type 'GetServerSidePropsContext<ParsedUrlQuery>': query, resolvedUrl
30 const result: GetServerSideProps = await getServerSideProps(context as GetServerSidePropsContext)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/pages/indexServerSide.test.ts:31:37 - error TS2339: Property 'props' does not exist on type 'GetServerSideProps<{ [key: string]: any; }, ParsedUrlQuery>'.
31 const props: HomeProps = result.props as HomeProps
~~~~~
Found 3 errors.
Acceptance Criteria
[ ] All typing in indexServerSide test is corrected
[ ] Remove //@ts-ignores & corresponding @typescript-eslint/ban-ts-comment comments from indexServerSide test
Description
Correct the typing errors in the indexServerSide test. Due to the interaction between NextJS & Jest the typing is reporting issues, and due to how the
context
object is updated via the call, we cannot cast it to unknown.Discovered & spun out of #571
Acceptance Criteria
//@ts-ignores
& corresponding@typescript-eslint/ban-ts-comment
comments from indexServerSide test