Typescript module not found

Hello Meteor community,

we are about to transfer our Meteor app code base to typescript and run into the following issue:
When referencing a typescript module outside the client or server folder, the app wont start, cause the typescript-module is not found (Error: Cannot find module '../tests/myTypedModule.ts').
The curious thing is, that it’s fine if we write it as plain javascript file (../tests/myNotTypedModule.js) or if we place the typescript file in the server folder (server/myTypedModule.ts).

How can we change the config of Meteor (or our typescript config) to add folders to the typescript compile step? Is it some issue in the babel-configuration within Meteor?

Here is a code sample of our setup:
code of “tests\util.ts” file

export const SOME_VAR = "BULULU";

code of importing module “server/sample.spec.ts” (does not compile)

import { expect } from 'chai';
import { SOME_VAR } from '../tests/util';

describe.only('sample tests', () => {
    it('some test', () => {
// some testing code
    });
});

1 Like