Typescript runtine setup, nakama runtime namespace cannot be found by the IDE

after watching the youtube tutorial video of how to setup a nakama runtime typescript project im trying to create a InitModule function but the IDE(vs code) cant find the nakama runtime namespace

my code:

function InitModule(ctx: nkruntime.Context, logger: nkruntime.Nakama, initializer: nkruntime.Initializer)
{
    
}

the error:

Cannot find namespace ‘nkruntime’

1 Like

Hello @spartan6nm

Please link the video tutorial you’re referring to.

I saw this error too. I wasn’t following any video tutorial, I was just copying the example Tic-Tac-Toe project.

I think this problem comes from typescript not having access to the nkruntime type declarations. Those type declarations are contained within nakama-common

It’s not a npm package, but you can add it to your project the same way the example repo does it, using npm install github:heroiclabs/nakama-common#master

The important part in that repo is the namespace declaration nakama-common/index.d.ts at 660e54f60a065def5519e0e281db8f6e1a9261d6 · heroiclabs/nakama-common · GitHub

I know this question is old, but in my searching for an answer, I was led to this forum post. I figured it out so I wanted to leave an answer for future readers. :heart: