parcel-antd icon indicating copy to clipboard operation
parcel-antd copied to clipboard

how to config with typescript

Open AntoninSorrento opened this issue 6 years ago • 5 comments

how to config with typescript?

AntoninSorrento avatar Oct 10 '18 06:10 AntoninSorrento

i did it

AntoninSorrento avatar Oct 18 '18 01:10 AntoninSorrento

@AntoninSorrento Congratulations! Would you mind sharing your solution for others to see?

karol-majewski avatar Oct 18 '18 08:10 karol-majewski

@karol-majewski assuredly

Config with TypeScript

keep this package's config ,some file need change

1 change -> .babelrc

  {
  "presets": [
    "@babel/preset-env"
  ],
  "plugins": [
    [
      "import",
      {
        "libraryName": "antd",
        "libraryDirectory": "es",
        "style": true
      }
    ]
  ]
}

2. add -> 'tsconfig.json'

{
  "compilerOptions": {
    "module": "esnext",
    "target": "es5",
    "lib": [
      "es6",
      "dom"
    ],
    "moduleResolution": "node",
    "rootDir": "src",
    "jsx": "react",
    "allowJs": true,
    "forceConsistentCasingInFileNames": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true,
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true
  },
  "exclude": [
    "node_modules",
    "build"
  ]
}

3. check package.json

image

start now!

image

AntoninSorrento avatar Oct 19 '18 03:10 AntoninSorrento

Thank you @AntoninSorrento!

karol-majewski avatar Oct 19 '18 11:10 karol-majewski

Thank you @AntoninSorrento

wangyongf avatar Jul 13 '19 10:07 wangyongf