Forge UI Kit using Typescript

I want to create a Forge app with UI Kit(not Custom UI) and I want to use typescript.
I changed the file extensions from js to ts and from jsx to tsx. I added tsconfig.json. How to build and deploy the app?

Hey, as long as your dev dependencies are good (that is, typescript is in your dev dependencies object in package.json) and you’ve updated your filenames in the manifest.xml file, forge deploy should take care of creating the js/jsx files from the ts/tsx files and upload to Atlassian cloud.

Here’s the tsconfig.json file I’m using. I like this because forge deploy won’t let me upload until I meet all these linting requirements, which keeps me honest:

{
  "compilerOptions": {
    "module": "NodeNext",
    "target": "ESNext",
    "sourceMap": true,
    "moduleResolution": "nodenext",
    "esModuleInterop": true,
    "lib": ["dom", "dom.iterable", "ESNext"],
    "types": ["node", "react"],
    "baseUrl": "./",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "allowJs": true,
    "jsx": "react",

    /* Linting */
    "strict": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "exactOptionalPropertyTypes": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noPropertyAccessFromIndexSignature": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
  },
  "include": ["./src/**/*"]
}
1 Like