Transitioning from the Java world, I am venturing into creating a vanilla JS (ES2018) Application with types documented in JSDOC. By using the TypeScript compiler, I aim to generate clean definition files that can be bundled with my app. With just two main files - client.js (containing a default-exported class) and constants.js (featuring a default-exported object with constants) located under src/, I intend to unite them under a common namespace in index.js:
import XApiClient from 'src/brokers/xtb/x_api_client';
import {Constants} from 'src/brokers/xtb/x_api_constants';
/**
* @namespace
* @property {Constants} Constants
* @property {XApiClient} XApiClient
*/
const XApi = {Constants: Constants, Client: XApiClient};
export default XApi;
Despite being used in other projects via npm+git, the Typescript compiler fails to recognize the type of XApi.XApiClient in this new project. This frustration has reached a point where I find myself contemplating giving up coding for a simpler life looking after goats in the hills.