Importing an interface in a Typescript file without generating a new directory structure

19 hours ago 1
ARTICLE AD BOX

So, I'm developing a web-app which uses server-side data via Node.js, and is accessed through a webview. I have two directories with typescript separate typescript files, one for the server side and one for the client side:

/ts /pub /tsconfig.json /foo.ts /bar.ts ... /sys /tsconfig.json /ApiResponse.ts /index.ts ...

pub is used for javascript intended to be loaded by the browser; sys is run by Node. Now, ApiResponse.ts looks like this:

export interface ApiResponseData { code?: number, title: string, ... }

What I want to know is, is it possible to use the ApiResponseData interface from within pub, without trying to transform ApiResponse.ts into a javascript file? Normally, the Javascript compile from the pub tsconfig looks like this:

/res /js /foo.js /bar.js ...

But when I use import { ApiResponse } from '../sys/ApiResponse.ts from within (say) foo.ts, it looks like this:

/res /js /pub /foo.js /bar.js ... /sys /ApiResponse.js

I feel like there should be a way of getting the ApiResponseData interface from within pub without causing that to happen, but I'm at a loss for how to do this.

Read Entire Article