Skip to content

[TS] Using type only imports to use types "normally"? #40

@MarcusRiemer

Description

@MarcusRiemer

The typescript setup guide tells the user to add "typeRoots": ["./node_modules"] to the tsconfig.json. This seems a little dangerous to me and from my PoV this could also be solved by using Type-Only imports from Typescript 3.8.
I went ahead and changed declare namespace nkruntime (see https://github.com/heroiclabs/nakama-common/blob/master/index.d.ts#L15) to export namespace nkruntime and then a corresponding import { nkruntime } from "nakama-runtime"; in my typescript file.

For me this works fine and nicely streamlines the development to be less "unusual".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions