React v.16.6 has been released and it brings lazy and Suspense.
Running tsc --build tsconfig.json throws:
src/components/DynamicComponent/index.tsx:28:24 - error TS2339: Property 'lazy' does not exist on type 'typeof React'.
28 component: React.lazy(() => import(this.state.url)),
~~~~
src/components/DynamicComponent/index.tsx:46:14 - error TS2339: Property 'Suspense' does not exist on type 'typeof React'.
46 <React.Suspense fallback={<div>Loading...</div>}>
~~~~~~~~
src/components/DynamicComponent/index.tsx:55:15 - error TS2339: Property 'Suspense' does not exist on type 'typeof React'.
55 </React.Suspense>
~~~~~~~~
@johnnyreilly @bbenezech @pzavolinsky
After being blocked by this, I took the less-than-ideal approach of simply adding // @ts-ignore before the React import
// @ts-ignore
import React, { Suspense, lazy } from 'react';
As per https://twitter.com/martin_hotell/status/1055381631094190080, it sounds like it will be a while before we get official types for React 16.6. I'd prefer to have access to lazy and Suspense until then.
I want to make use of the new ExoticComponent definition in #29990 to add the other new types, so this might have to wait until it is merged.
Had no opportunity to test this out yet, but I am wondering, is lazy loaded component properly inferred for prop types?
It does work locally 馃槆

@dbchristopher This did not work for me so I used another workaround:
import React from "react";
const Suspense = (React as any).Suspense;
const lazy = (React as any).lazy;
This was added in #30054.
@arkon You're right, will close this issue.
Most helpful comment
@dbchristopher This did not work for me so I used another workaround: