Amity TS complie errors (No exported member)

Runtime: Angular, Typescript.

I’ve followed developer docs, successfully installed the 6.16.0 version and also tried with the 6.15.1-fa5fd2f.0 (amityco/ts-sdk) BUT i’ve got a lot typescript errors.

I’ve also tried to rollback my typescript version to 4.7 and it works, but the 17.0 angular version does not supports that version of TS.

Example errors:

  • Error: node_modules/@amityco/ts-sdk/dist/userRepository/relationship/block/observers/getBlockedUsers.d.ts:1:54 - error TS2724: ‘global.Amity’ has no exported member named ‘BlockedUsersLiveCollection’. Did you mean ‘UserLiveCollection’?
  • Error: node_modules/@amityco/ts-sdk/dist/marker/events/onChannelMarkerFetched.d.ts:16:78 - error TS2694: Namespace ‘global.Amity’ has no exported member ‘ChannelMarker’.
  • Option ‘–resolveJsonModule’ cannot be specified when ‘moduleResolution’ is set to ‘classic’.ts

Similar like this: TypeScript Build Errors in Amity SDK - #3 by ahmedsakri
But i have no “vite”.

angular-devkit/architect 0.1700.10
angular-devkit/build-angular 17.0.10
angular-devkit/core 17.0.10
angular-devkit/schematics 17.0.10
angular/cli 17.0.10
schematics/angular 17.0.10
rxjs 7.5.7
typescript 5.2.2
zone.js 0.14.3

Node version: v18.18.0

I’ve created a fresh (Not angular based) project and got the same error(s)

Package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@amityco/ts-sdk": "^6.16.0",
    "typescript": "^5.3.3"
  }
}

Amity.ts

import { API_REGIONS, Client } from "@amityco/ts-sdk";

const client = Client.createClient('', API_REGIONS.EU);

const sessionHandler = {
    sessionWillRenewAccessToken(renewal: Amity.AccessTokenRenewal) {
        // for details on other renewal methods check session handler
        renewal.renew();
    },
};

tsc amity.ts

Found 85 errors in 34 files.

Errors  Files
    11  node_modules/@amityco/ts-sdk/dist/@types/core/events.d.ts:15
     3  node_modules/@amityco/ts-sdk/dist/@types/core/live.d.ts:11
     1  node_modules/@amityco/ts-sdk/dist/@types/core/paging.d.ts:43
    24  node_modules/@amityco/ts-sdk/dist/@types/core/payload.d.ts:51
     2  node_modules/@amityco/ts-sdk/dist/@types/core/query.d.ts:38
     1  node_modules/@amityco/ts-sdk/dist/@types/domains/channel.d.ts:40
     5  node_modules/@amityco/ts-sdk/dist/@types/domains/client.d.ts:1
     2  node_modules/@amityco/ts-sdk/dist/@types/domains/comment.d.ts:39
     1  node_modules/@amityco/ts-sdk/dist/@types/domains/message.d.ts:85
     3  node_modules/@amityco/ts-sdk/dist/@types/domains/post.d.ts:12
     1  node_modules/@amityco/ts-sdk/dist/@types/domains/story.d.ts:129
     2  node_modules/@amityco/ts-sdk/dist/@types/domains/subChannel.d.ts:33
     1  node_modules/@amityco/ts-sdk/dist/client/api/createClient.d.ts:1
     1  node_modules/@amityco/ts-sdk/dist/client/events/onConnectionError.d.ts:1
     3  node_modules/@amityco/ts-sdk/dist/client/utils/markerSyncEngine.d.ts:5
     1  node_modules/@amityco/ts-sdk/dist/core/query/filtering.d.ts:35
     3  node_modules/@amityco/ts-sdk/dist/core/query/paging.d.ts:53
     1  node_modules/@amityco/ts-sdk/dist/core/subscription.d.ts:1
     1  node_modules/@amityco/ts-sdk/dist/external/api/createUserToken.d.ts:1
     2  node_modules/@amityco/ts-sdk/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts:31
     3  node_modules/@amityco/ts-sdk/dist/feedRepository/api/queryGlobalFeed.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/marker/events/onChannelMarkerFetched.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/marker/events/onFeedlMarkerFetched.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/marker/events/onFeedlMarkerUpdated.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/marker/events/onMessageMarked.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/marker/events/onMessageMarkerFetched.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/marker/events/onSubChannelMarkerFetched.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/marker/events/onSubChannelMarkerUpdated.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/marker/events/onUserMarkerFetched.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/role/api/queryRoles.d.ts:29
     1  node_modules/@amityco/ts-sdk/dist/userRepository/observers/getBlockedUsers.d.ts:16
     1  node_modules/@amityco/ts-sdk/dist/userRepository/observers/getReachedUsers.d.ts:1
     1  node_modules/@amityco/ts-sdk/dist/userRepository/observers/getViewedUsers.d.ts:6
     1  node_modules/@amityco/ts-sdk/dist/userRepository/relationship/block/observers/getBlockedUsers.d.ts:1
1 Like

Update and temp. solution; I’ve added these into my tsconfig:

  "compilerOptions": {
    "removeComments": true,
    "allowSyntheticDefaultImports": true,
    "incremental": true,
    "skipLibCheck": true,
 },
"exclude": ["node_modules", "dist"],

It works now, but took about 1-2 hours to solve it:D

1 Like

Hello @remote44 , Fantastic news! :tada: We’re thrilled to learn that you managed to resolve the issue on your own. While we regret the delay in our response, we appreciate your patience.

If you encounter any more challenges or have further questions down the road, please don’t hesitate to reach out. We’re here to help!