An async function or method in ES5/ES3 requires the Promise constructor. Make sure you have a declaration for the Promise constructor or include ES2015 in your --lib option.
Also doing the same implementation so I want to follow up with you all here. I’ve gotten my react-auth0-spa.tsx to work but unsure if I’m doing things right.
My lib option of tsconfig.json looks exactly the same but I’m not getting the TS errors:
"lib": [
"dom",
"dom.iterable",
"esnext"
],
When would Auth0 create an official Typescript wrapper?
Any updates James? Still can’t get react-auth0-spa.js to compile in TypeScript. This is preventing us from using Auth0 in our SPA website even though we are an Auth0 customer.
We should have a blog post coming soon on react + typescript. I don’t have any dates, but hopefully it will provide some insight when it arrives. In the mean time, have you seen this thread on GitHub? https://github.com/auth0/auth0-spa-js/issues/39
There are some possibilities here. However, our site is 100% TypeScript and w/o TS support forAuth0 we can’t proceed. Authentication is critical and our development is pretty much on hold. Is there any way this can be expedited?
Can you give us more insight on what you would like to see specifically? What is confusing, what part of the stack, what frameworks, etc. I am happy to share your feedback with the relevant parties if you describe your needs. I can’t guarantee any dates on when the content will be live, but I can certainly advocate for you.
The problem is the react-auth0-spa.js sample in the React Starter code does not work in TypeScript. If I take the sample code and put it in a .ts file there are a number of TypeScript errors. I’ve tried several approaches to get it to work without success.
It would be really helpful is the React starter code included both JS and TypeScript samples. Without a TS sample we are unable to use Auth0 in our site despite being a customer. Whatever you can do to expedite this would be appreciated.
Down a rabbit hole today with this. Preface w/ I’m new to TypeScript and the JS world mostly. Webpack & TypeScript have lead to headaches the past few days.
I’m going for TypeScript, React & a functional approach (via React Hooks). Again, still a newbie, so I may butcher some of the linguistics.
I rewrote the sample code from the Quickstart here.
I was banging my head against the wall for hours. Everything compiled, things were serving, but for some reason, the createAuth0Client (imported) was undefined . Why? I still do not know. But, I checked out @tommedema’s first link above. More specifically, I checked out the tsconfig.json and saw he had this compilerOption that I was missing "esModuleInterop": true. Added that and all is well