A. L
A. L

Reputation: 12649

How to use a global module

So I have

declare module "test" {
    declare export type running = number;
}

in a lib file, and I was wondering how to use the module and what it's really for.

If I try something like:

async function testMe (testing_stuff /* : test.running */) {
}

It doesn't know what test is.

But if I don't have it in a module I can just straight up use running e.g.

declare type running = number;

Then use it as:

async function testMe (testing_stuff /* : running */) {
}

So what is the use of module here?

Upvotes: 2

Views: 36

Answers (1)

loganfsmyth
loganfsmyth

Reputation: 161457

You should be able to do

/*:: import type { running } from "test"; */

async function testMe (testing_stuff /* : running */) {
}

to import the type from the module.

Upvotes: 1

Related Questions