Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the type definition issue on StyleDeclarationMap #388

Open
Shad02w opened this issue Feb 5, 2020 · 2 comments
Open

About the type definition issue on StyleDeclarationMap #388

Shad02w opened this issue Feb 5, 2020 · 2 comments

Comments

@Shad02w
Copy link

Shad02w commented Feb 5, 2020

TypeScript Version: 3.7.5
Aphrodite Version: 2.4.0
When I using StyleSheet create function

const style = StyleSheet.create({
    container: {
    }
})

I found out that VS Code is not able to give me any autocomplete suggestion on those CSS properties, since they think StyleDeclarationMap is a type of 'any'

Snipaste_2020-02-05_18-37-10
but it is not
Snipaste_2020-02-05_18-35-36

I have changed typescript version and modified my tsconfig file, but nothing make it work.

I wonder how can I fixed this issue?

@Shad02w
Copy link
Author

Shad02w commented Feb 5, 2020

I just figured it out myself, all you need to do is change compile target in tsconfig.json from "es5" to "es6", since typescript may not support Map object when targeting "es5".

For reference :microsoft/TypeScript#6842

@ranzolinrafa
Copy link

ranzolinrafa commented Dec 10, 2020

I'm having same problem, already changed my target to ES6 in tsconfig.json but the auto complete stills dont work

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "declaration": true,
    "module": "ESNext",
    "target": "ES6",
    "lib": ["es6", "dom", "es2016", "es2017"],
    "sourceMap": true,
    "jsx": "react",
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "rootDir": "./src",
    "outDir": "./dist",
    "composite": true,
    "noEmit": false
  }
}

I just figured it out myself, all you need to do is change compile target in tsconfig.json from "es5" to "es6", since typescript may not support Map object when targeting "es5".

For reference :microsoft/TypeScript#6842

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants