Code Monkey home page Code Monkey logo

Comments (10)

frankwallis avatar frankwallis commented on June 11, 2024

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.

MicahZoltu avatar MicahZoltu commented on June 11, 2024

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.

sarith avatar sarith commented on June 11, 2024

+1 for @Zoltu's recommendation above. Seems to make the most sense intuitively.

from plugin-typescript.

 avatar commented on June 11, 2024

+1 so I don't have to use relative paths everywhere.

When you are levels deep. having ../../../ sucks.

from plugin-typescript.

 avatar commented on June 11, 2024

@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.

frankwallis avatar frankwallis commented on June 11, 2024

@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.

cherrydev avatar cherrydev commented on June 11, 2024

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.

basarat avatar basarat commented on June 11, 2024

I prefer tsconfig: /path/to/tsconfig. There is discussion about this here : TypeStrong/discussions#1 🌹

from plugin-typescript.

frankwallis avatar frankwallis commented on June 11, 2024

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.

basarat avatar basarat commented on June 11, 2024

awesome!

from plugin-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.