Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

0
Typescript errors on code that works using React Native Libraries. Specifically React Navigation and React Native Paper
Post Body

So I am using TypeScript for the first time, and I really like that it prevents me from making really stupid errors that I used to make all the time. But the main way I know to get it to not yell at me is to declare an interface above the default function that is going to be passed through, make the props of type of the declared interface, and there we go. This is really straight forward for custom things you make yourself, but I am confused on how to do things for components imported from libraries. The first error I get is some version of these two errors in conjunction:

Type 'string' is not assignable to type 'keyof StackNavigatorProps'.ts(2322)

types.d.ts(349, 5): The expected type comes from property 'name' which is declared here on type 'IntrinsicAttributes & RouteConfig<StackNavigatorProps, keyof StackNavigatorProps, StackNavigationState<ParamListBase>, StackNavigationOptions, StackNavigationEventMap>'

And then there is also some version of these two errors in conjunction:

No overload matches this call.

  Argument of type '[string]' is not assignable to parameter of type '[screen: "userName", params: { name: string; nextPage: string; question: string; subtitle: string | null; options: any[] | null; answer: null; needsImportance: boolean; importance: string | null; skippable: boolean; ... 6 more ...; index: number; }] | [screen: ...] | [screen: ...]'.
    Type '[string]' is not assignable to type '[screen: "pronouns", params: { name: string; nextPage: string; question: string; subtitle: string | null; options: any[] | null; answer: null; needsImportance: boolean; importance: string | null; skippable: boolean; ... 6 more ...; index: number; }]'.
      Source has 1 element(s) but target requires 2.
  Overload 2 of 2, '(options: { key: string; params?: { name: string; nextPage: string; question: string; subtitle: string | null; options: any[] | null; answer: null; needsImportance: boolean; importance: string | null; ... 7 more ...; index: number; } | undefined; merge?: boolean | undefined; } | ... 4 more ... | { ...; }): void', gave the following error.
    Argument of type 'string' is not assignable to parameter of type '{ key: string; params?: { name: string; nextPage: string; question: string; subtitle: string | null; options: any[] | null; answer: null; needsImportance: boolean; importance: string | null; ... 7 more ...; index: number; } | undefined; merge?: boolean | undefined; } | ... 4 more ... | { ...; }'.ts(2769)

The code works as I have it but because of the type system I guess it's warning me that it may not in all circumstances? So any help would be appreciated so I don't keep going and build up dozens of error messages

Author
Account Strength
80%
Account Age
2 years
Verified Email
Yes
Verified Flair
No
Total Karma
9,745
Link Karma
1,834
Comment Karma
7,565
Profile updated: 3 days ago
Posts updated: 4 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago