Title: Using Typescript
Last modified: September 28, 2021

---

# Using Typescript

 *  [Penfold1000](https://wordpress.org/support/users/penfold1000/)
 * (@penfold1000)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/using-typescript/)
 * I am building a Gutenberg block which I have previously had working and am now
   refactoring to use Typescript. I am getting an error where it tries to import
   the block.json file and as a result the block does not get registered in the 
   editor.
 * Here is my tsconfig.js file:
 *     ```
       {
           "compilerOptions": {
             "outDir": "./build/",
             "noImplicitAny": true,
             "module": "commonjs",
             "target": "es5",
             "jsx": "react",
             "allowJs": true,
             "moduleResolution": "node",
             "allowSyntheticDefaultImports": true,
             "esModuleInterop": true,
             "resolveJsonModule": true
           },
           "include": [
             "src/*"
           ]
       }
       ```
   
 * Here is the block.json:
 *     ```
       {
           "apiVersion": 2,
           "name": "bootstrap-components/accordion",
           "version": "0.1.0",
           "title": "Accordion Block",
           "category": "widgets",
           "icon": "smiley",
           "description": "Example block written with ESNext standard and JSX support – build step required.",
           "supports": {
               "html": false
           },
           "textdomain": "bootstrap-components",
           "editorScript": "file:../../../build/index.js",
           "editorStyle": "file:../../../build/index.css",
           "style": "file:../../../build/style-index.css"
       }
       ```
   
 * which is imported into index.tsx using import metadata from ‘./block.json’;.
 * The error I get is: `Argument of type '{ apiVersion: number; name: string; version:
   string; title: string; category: string; icon: string; description: string; supports:{
   html: boolean; }; textdomain: string; editorScript: string; editorStyle: string;
   style: string; }' is not assignable to parameter of type 'string'.ts(2345)`
 * Any help much appreciated.
    -  This topic was modified 4 years, 7 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).
      Reason: moved to "developing"

Viewing 1 replies (of 1 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/using-typescript/#post-14931789)
 * Review and see if this `block-tutorial` points in a right direction:
    [https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/writing-your-first-block-type/#registering-the-block](https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/writing-your-first-block-type/#registering-the-block)

Viewing 1 replies (of 1 total)

The topic ‘Using Typescript’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/using-typescript/#post-14931789)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
