Typescript error (TS2464): Computed property
See original GitHub issuegatsby-plugin-emotion
version: 4.0.6react
version: 16.8.4
Relevant code:
const StyledLink = styled(Link)({...});
const MobileLinkContainer = styled("div")({
...
[StyledLink]: {
padding: "1rem"
}
});
What happened:
I get an error: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ts(2464)
at the [StyledLink]
line
Suggested solution:
A workaround is to use [StyledLink as any]
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:12 (4 by maintainers)
Top Results From Across the Web
TypeScript A computed property name in a type literal must ...
ts (..,..): A computed property name in a type literal must directly refer to a built- in symbol. ...: Cannot find name 'any'....
Read more >TS2464: A computed property name must be of type 'string ...
TS2464 : A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ... Handling errors like a pro in TypeScript....
Read more >Documentation - TypeScript 2.9
String-like properties of an object type are those declared using an identifier, a string literal, or a computed property name of a string...
Read more >computedPropertyNames17_ES6.errors.txt
Member "TypeScript-4.9.4/tests/baselines/reference/ ... error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
Read more >Dynamically added functions in TypeScript - Mees van Dongen
ts(1169) * A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ts(2464) */ // interface RootFunction extends ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We’ve been experiencing the same issue for our projects, Rather than typing the
StyledCheckbox
toany
, you can instead do it in the directly within the computed property. This way you keep nice type introspection for the rest of your application:Anyone got anything on this? this is still an issue.