Comments (10)
This sounds reasonable, so I can add a setting to typescriptOptions tsconfig
which will contain the path of a tsconfig.json file or just be set to true to load /tsconfig.json?
typeScriptOptions: {
tsconfig: true,
tsconfig: "/.settings/tsconfig.json",
resolveAmbientRefs: true
}
from plugin-typescript.
I'm guessing that a person would either use a tsconfig.json
or provide the options through typeScriptOptions
. I can't think of a situation where you would want to mix the two. I suppose if a user did want to override some settings it would probably be specific to runtime plugin, so maybe the merge strategy would be to pull in all of the information from tsconfig.json
and then overwrite any explicit options provided via typeScriptOptions
?
tsconfigPath: 'relative/path/to/tsconfig.json',
typeScriptOptions: {
resolveAmbientRefs: true
}
I will admit, I haven't really thought this through very hard, I just started using the typescript plugin with SystemJS and the first thing I looked into was using my existing tsconfig.json
settings since I already have those setup so my IDE can correctly do type checking.
from plugin-typescript.
+1 for @Zoltu's recommendation above. Seems to make the most sense intuitively.
from plugin-typescript.
+1 so I don't have to use relative paths everywhere.
When you are levels deep. having ../../../ sucks.
from plugin-typescript.
@frankwallis if tsconfig support is supported, would this be possible using in browser compilation?
src/app.ts
then src/module/component/comp1/comp1.ts import {default as d} from 'app';
work?
Right now you must do `import {default as d} from '../../../app'; with this plugin. compiling with the ts compiler and the tsconfig doesn't do it.
from plugin-typescript.
@robertbaker - I am not sure if this works even when building with the TypeScript compiler, it seems to me that the code would fail at runtime unless the compiler rewrites the import in the generated JavaScript to point to the correct file. Support for resolution mappings is being handled under microsoft/TypeScript#2338.
Currently my plan for tsconfig support is just to load the compiler options (which will actually just be the subset of the options which do not conflict with those used by plugin-typescript) and to use it to automatically load any reference files contained in the 'files' array.
from plugin-typescript.
Just my $0.02 about having both tsconfig and specifying compiler options: The command-line tsc supports this specifically, with command line options overriding options in the tsconfig file.
from plugin-typescript.
I prefer tsconfig: /path/to/tsconfig
. There is discussion about this here : TypeStrong/discussions#1 🌹
from plugin-typescript.
Ok I have finally added tsconfig.json support (in 2.1.0), you can use
tsconfig: true
to load from "tsconfig.json", or set it to a path which will be resolved to locate the file:
tsconfig: "config/mytsconfig.json"
The plugin loads compiler options and declaration files from the files array when type-checking is enabled. I have updated some of the examples to show it working. Let me know if you have any problems, thanks.
from plugin-typescript.
awesome!
from plugin-typescript.
Related Issues (20)
- 7.x branch not on npm? HOT 1
- Unexpected export encountered on abstract classes HOT 3
- defaulting to tsconfig: true HOT 6
- tslib_1.__metadata is not a function HOT 2
- Plugin-Typescript doesn't completely strip out Interface import/exports which breaks rollup. HOT 12
- no such file or directory: `plugin-typescript/lib.js` HOT 7
- exports is not defined HOT 3
- js error when loading - cannot read property 'length' of undefined HOT 6
- ENOENT: no such file or directory HOT 1
- Systemjs builder output not working as expected HOT 2
- No console output from Typescript compilation errors HOT 1
- Lookup error at node v8.1.2 npm 5.0.3 HOT 2
- Support for "module": "ESNext" HOT 1
- Not compatible with Typescript 2.6.x package HOT 1
- Getting "Cannot read property 'map' of undefined" HOT 1
- Is it possible to load global script? HOT 6
- tsconfig extends HOT 3
- Error: require is not defined HOT 8
- Does not work with typescript 2.9.1 and above HOT 1
- Getting errors during npm install
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-typescript.