emotion version: 9.2.12react version: 16.5.2Relevant code.
import styled from 'react-emotion/macro'
const H1 = styled.h1({
fontSize: 48,
textAlign: 'center',
})
What you did:
Using react-emotion/macro in create-react-app.
What happened:
Visual Studio Code can't find typescript declaration file and autocompletion stops working.
Thank you for reporting this issue!
We currently don't have typings for macro files.
I will add types for those files in emotion@10, after fixing some other issues.
Thanks for your effort.
@irrigator In a meantime, you can define your local definition like
declare module 'react-emotion/macro' {
import styled from 'react-emotion';
export * from 'react-emotion';
export default styled;
}
hi, any update here? I'm using emotion v10 and I'm getting the same error
Could not find a declaration file for module '@emotion/css/macro'
Could not find a declaration file for module '@emotion/css/macro'
am I missing something?
thanks
No, it's not yet provided. I'm recently too busy to update one. If you want to send a PR for this, feel free to send it and we will welcome.
Updated workaround:
declare module '@emotion/styled/macro' {
import styled from '@emotion/styled';
export * from '@emotion/styled';
export default styled;
}
It seems this hasn't been published yet - any plans on a release containing this?
Has this been published? I'm still getting the error :/
As of @emotion/styled v10.0.11 (current version), the file added in #1315 (macro.d.ts) is not available as it has not been whitelisted in the package.json. So it does not appear in the current build available on NPM.
It is also curious that v10.0.11 doesn't appear in the GitHub releases panel, only on NPM and inside the CHANGELOG.md for @emotion/styled.
I've created a PR to fix this (#1369).
For future reference, you can browse the latest release here and browse v10.0.11 specifically here.
My PR to ship macro.d.ts has been merged. This issue should be properly resolved with the next release.
Most helpful comment
Updated workaround: