Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ts ignroe inside render method of .tsx

This error drives me crazy

Error:(57, 32) TS2339: Property 'mongoProjects' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Pick<RouteComponentProps<any, StaticCont...'.

As I understand it, it's impossible to fix. Typescript in React is a real hassle!

Is it possible to add a ts ignore comment inside the tsx render method?

enter image description here

<GraphQlDataFetcher query={getProjects()}>
            {(data, refetch) => (
              <>
                <CreateProject mongoProjects={data.projects}/> // ts ignore on this error
                <BootstrapTable
                  keyField="_id"
                  data={data.projects}
                  columns={columns}
                />
              </>
            )}
          </GraphQlDataFetcher>
like image 763
Joe Avatar asked Feb 21 '19 11:02

Joe


1 Answers

this my friend

<GraphQlDataFetcher query={getProjects()}>
        {(data, refetch) => (
          <>
            {
              // @ts-ignore
              <CreateProject mongoProjects={data.projects}/>                      
            }
            <BootstrapTable
              keyField="_id"
              data={data.projects}
              columns={columns}
            />
          </>
        )}
      </GraphQlDataFetcher>
like image 92
Juraj Kocan Avatar answered Oct 12 '22 09:10

Juraj Kocan