-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Closed
Labels
type: bugAn issue or pull request relating to a bug in GatsbyAn issue or pull request relating to a bug in Gatsby
Description
It seems like async/await it not working when using gatsby-plugin-typescript :( The following error is thrown:
{my path}/gatsby-site/src/pages/index.tsx Unexpected token (13:26) You may need an appropriate loader to handle this file type.
this is how the pages/index.tsx looks like. It works without any problems if index.tsx is renamed to index.js (not typescript), but this is not desirable.
`
import * as React from 'react'
import Link from 'gatsby-link'
const asyncFunc = () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('done!')
}, 1000)
})
}
const getStuff = async () => {
return await asyncFunc()
}
const IndexPage = (props: any) => {
const test = getStuff()
return (
...something
)
}
export default IndexPage
`
jpoon
Metadata
Metadata
Assignees
Labels
type: bugAn issue or pull request relating to a bug in GatsbyAn issue or pull request relating to a bug in Gatsby