I am following instructions from the this answer, but cannot make the solution work.
Overview
I want to use import { Type } from "Module" instead of /// <reference path="..." />
Structure
-app\ -ViewModel.ts -Program.ts ViewModel.ts
export module Demo { export class ViewModel { constructor(public test: string) { } } } Program.ts
import { ViewModel } from "ViewModel"; Module 'C:/DemoApp/app/ViewModel' has no exported member 'ViewModel'.
and...
Only 'amd' and 'system' modules are supported alongside --outFile.
Goal
I want to be able to reference dependencies so that they compile to a single file in order.
If I add "module": "system" I still get the 1st of the aforementioned errors.
As per the 1st solution, I do not want to lose namespaces.
13 Answers
Remove the line below from your statement
export module Demo and use it like
export class ViewModel { constructor(public test: string) { } } Edit: For namespace, just do something like
namespace Demo { export class ViewModel { constructor(public test: string) { } } } 2One reason can be typo.
export const Demo = () => {} cannot be exported if it does not return a value. export const Demo =()=> () can be exported without return. May not be or check the module which you're using there.
export a () => { console.log("Hello world!"); } 2