# TypeScript Build Errors in Amity SDK

**URL:** <https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742>\
**Category:** Web\
**Created:** [May 17, 2023, 12:07pm UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742 "2023-05-17T12:07:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmedsakri](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@ahmedsakri](https://forum.social.plus/u/ahmedsakri)\
**Post date:** [May 17, 2023, 12:07pm UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742/1 "2023-05-17T12:07:03Z")

</div>

Hi team,

We are started working with Amity typescript SDK by following the link : [https://docs.amity.co/installation-and-authentication/install-ts-reactnative-sdk](https://docs.amity.co/installation-and-authentication/install-ts-reactnative-sdk)

But when we are going to create a build then it shows lots of errors regarding the SDK.  
I attached the Image of the logs to understands you. Please check and give us a solutions so we can start further. development.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/amity/original/1X/1803ddfa249d81e339447ae7cbf45629ac9abf05.png)

---

<div class="post-metadata">

**Author:** ![cijin](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@cijin](https://forum.social.plus/u/cijin)\
**Post date:** [May 18, 2023, 11:41am UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742/2 "2023-05-18T11:41:16Z")

</div>

Hey @ahmedsakri,

Thank you for reaching out. Could you provide some additional info please. Like the `version` of SDK you are using. Looks like you are using `vite`, I’ll need to check if additional configs are required for Vite.

In the meatime:

1. Could you please check if the `dist` folder inside `node_modules/@amityco/ts-sdk` has `@types` defined?
2. Try this or a similar vite [plugin](https://github.com/qmhc/vite-plugin-dts) too please

Kind regards,  
Cijin

---

<div class="post-metadata">

**Author:** ![ahmedsakri](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@ahmedsakri](https://forum.social.plus/u/ahmedsakri)\
**Post date:** [May 18, 2023, 12:09pm UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742/3 "2023-05-18T12:09:43Z")

</div>

Hey @cijin ,

Thanks for immediate response. Please refer below versions that i am using in my application.

- “vite”: “4.0.4”
- “amityco/ts-sdk”: “^6.2.0”
- “typescript”: “4.9.4”

I tried the Vite plugin but didn’t work for me. it gives me the same error as earlier.  
I checked the dist folder, @types is defined there. ( i have attached the screenshot below )

 ![Screenshot 2023-05-18 at 5.37.12 PM](https://europe1.discourse-cdn.com/flex013/uploads/amity/original/1X/378b88a3381a8537d1da1c273c629d0eaf503516.png)

Thanks

---

<div class="post-metadata">

**Author:** ![cijin](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@cijin](https://forum.social.plus/u/cijin)\
**Post date:** [May 22, 2023, 5:19am UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742/4 "2023-05-22T05:19:45Z")

</div>

Hey @ahmedsakri,

I was on leave but I’m back to work today. I’ll create a ticket and try to reproduce this issue. Will get back to you with some update.

Thank you for being patient.

Kind regards,  
Cijin

---

<div class="post-metadata">

**Author:** ![cijin](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@cijin](https://forum.social.plus/u/cijin)\
**Post date:** [May 22, 2023, 7:12am UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742/5 "2023-05-22T07:12:33Z")

</div>

Hey @ahmedsakri,

I’ve tried to use the SDK with an official [vite template](https://vitejs.dev/guide/) for React Typescript.  
Types work as expected. The build does succeed as well without any errors. I’m unable to reproduce your issue.

These are the versions I’m using:

```auto
  "dependencies": {
    "@amityco/ts-sdk": "^6.2.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/react": "^18.0.28",
    "@types/react-dom": "^18.0.11",
    "@typescript-eslint/eslint-plugin": "^5.57.1",
    "@typescript-eslint/parser": "^5.57.1",
    "@vitejs/plugin-react": "^4.0.0",
    "eslint": "^8.38.0",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.3.4",
    "typescript": "^5.0.2",
    "vite": "^4.3.2"
  }

```

 ![vite](https://europe1.discourse-cdn.com/flex013/uploads/amity/original/1X/db3b3b661a819b0c9653f44e15ebd9e32f50d3a9.png)

Also, highly unlikely that this is an SDK issue. Feel free to let me know if I can help you with anything  
else.

Kind Reagards,  
Cijin

---

<div class="post-metadata">

**Author:** ![ahmedsakri](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@ahmedsakri](https://forum.social.plus/u/ahmedsakri)\
**Post date:** [May 22, 2023, 7:19am UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742/6 "2023-05-22T07:19:39Z")

</div>

> [@cijin](#):
>
> `typescript`

Hi @cijin,

This errors occurs when we ran “tsc & vite build” command.

Thanks

---

<div class="post-metadata">

**Author:** ![cijin](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@cijin](https://forum.social.plus/u/cijin)\
**Post date:** [May 22, 2023, 7:36am UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742/7 "2023-05-22T07:36:34Z")

</div>

Hey @ahmedsakri,

Yup, I ran the command. I’ve added a screenshot of the cli output.

---

<div class="post-metadata">

**Author:** ![ahmedsakri](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@ahmedsakri](https://forum.social.plus/u/ahmedsakri)\
**Post date:** [May 22, 2023, 9:04am UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742/8 "2023-05-22T09:04:00Z")

</div>

Hey @cijin,

It would be great if we can connect on a quick call. A google meet maybe?  
Because, the issue occurs to me. When i run command `build: tsc && vite build`

vite.config.ts includes below config:

///   
import react from ‘@vitejs/plugin-react’;  
import { defineConfig } from ‘vite’;

export default defineConfig({  
plugins: [react()],  
server: {  
port: 3001,  
},  
});

---

<div class="post-metadata">

**Author:** ![cijin](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@cijin](https://forum.social.plus/u/cijin)\
**Post date:** [May 22, 2023, 9:29am UTC](https://forum.social.plus/t/typescript-build-errors-in-amity-sdk/742/9 "2023-05-22T09:29:45Z")

</div>

Hey @ahmedsakri,

I am sorry but I’ve got a few other things to take care of. As it’s not an SDK issue I’m afraid I can’t be of much help. As I’m not aware of the configs you are using.

You could try updating `vite` see if that solves the issue. The same one that I used in the response above.

If there is an SDK specific issue please reach out.

Kind regards,  
Cijin
