I am seeking information on how exports and imports work in NodeJS using TypeScript.
My setup is:
- NodeJS
- Everything in Typescript
- TSLint
- Typings
I am messing about with exports/imports instead of doing some proper coding, it's driving me nuts, and cannot find any proper explanation of how it works.
Import
What do the following mean?
var module = require ("module");
import module = require("module");
import module from "module";
import {something} from "module";
import * as module from "module";
Export
What do the following mean?
export = something;
export default something;
export interface|class something;
Questions
- How do properly export/import a class without initiating it
- How do properly export/import a class with it being initiated (construct did run)
- How do I properly export/import a class and interface
- How do I properly export/import class and multiple interfaces
- When to use modules declarations, what are they good for and why is tslint throwing errors at me if I try to use them.
I cannot seem to find proper way of doing exports vs. imports so my IDE is not covered in red and throwing hundreds of errors at me.
General Questions
- Is there even a way to not get errors using Nodejs/TypeScript/tslint?
- TSLint is screaming at me for almost anything I type... it is extremely frustrating since there is no explanation to most of the errors. Is it even worth using it?
List of questions goes on and on, but I'm sure once some of the above is answered, I can pick up on the rest.
namespace
s in Typescript should be avoided as much as possible – Indices