import * as React from 'react'; import { AuthenticationContext, adalFetch, adalGetToken, runWithAdal, withAdalLogin, AdalConfig } from 'react-adal'; const resourceUrl = 'https://graph.microsoft.net'; const adalConfig: AdalConfig = { cacheLocation: "localStorage", clientId: '9ha8cqc6-4668-459a-9272-f48c80a053y5', endpoints: { api: resourceUrl }, postLogoutRedirectUri: 'https://localhost:3000', tenant: 'tenantname.onmicrosoft.com' }; const authContext = new AuthenticationContext(adalConfig); const adalApiFetch = (fetch: any, url: string, options: any) => { return adalFetch(authContext, resourceUrl, fetch, url, options); }; const getToken = () => adalGetToken(authContext, resourceUrl); class App extends React.Component { render() { return null; } } // user must login to use the app runWithAdal(authContext, () => { // ReactDOM.render(, document.getElementById('react-app') as HTMLElement); }, false); const withAdalLoginApi = withAdalLogin(authContext, resourceUrl); const Loading: React.SFC = (props) => { return null; }; const ErrorPage: React.SFC = (props) => { return null; }; class SignInPage extends React.Component { render() { return null; } } class ProtectedPage1 extends React.Component { render() { return null; } } const ProtectedPage2: React.SFC = (props) => { return null; }; const AdalProtectedPage1 = withAdalLoginApi(ProtectedPage1, () => , () => ); const AdalProtectedPage2 = withAdalLoginApi(ProtectedPage2, () =>

loading...

, () =>

It seems something went wrong...

); // user must login to use only specific pages runWithAdal(authContext, () => { const routes =
// $ExpectError // $ExpectError // $ExpectError
; // $ExpectError const App = ; // $ExpectError ReactDOM.render(, document.getElementById('react-app') as HTMLElement); }, true);