Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Compiler option to specify an alternate lib.d.ts #494

Closed
sedwards2009 opened this issue Aug 20, 2014 · 5 comments

Comments

Projects
None yet
6 participants
@sedwards2009
Copy link

commented Aug 20, 2014

The compiler has an option noLib which disables the default inclusion of lib.d.ts during compilation. Unfortunately there is no compiler option to specify a .d.ts file or files to automatically include before compiling each .ts file. Such an option would make it much easier to use an alternate lib.d.ts.

The work around now is to use the noLib option and then to add a line to each source file to manually pull in your alternate lib.d.ts.

@mhegazy mhegazy added the Bug label Aug 20, 2014

@mhegazy mhegazy self-assigned this Aug 20, 2014

@mhegazy mhegazy added this to the TypeScript 1.2 milestone Aug 20, 2014

@NoelAbrahams

This comment has been minimized.

Copy link

commented Aug 21, 2014

compiler option to specify a .d.ts file or files to automatically include before compiling each .ts file. Such an option would make it much easier to use an alternate lib.d.ts.

👍

I believe there is a larger issue here than simply including an alternate lib.d.ts. If we have a mechanism for specifying a directory then it should be possible to add the shared declarations there, for example, node.d.ts etc.

This would also solve the problem Split official "lib.t.ts" into different files / Special references clauses

We have a requirement to reduce the number of global variables (properties on window) such as name, length, location etc, because it causes errors to slip through (e.g. renaming a local variable called name will fail to highlight occurrences).

@basarat

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2014

@NoelAbrahams I've been bitten by item :) (not badly though)

@NoelAbrahams

This comment has been minimized.

Copy link

commented Aug 21, 2014

@basarat, that's an interesting one. It's quite a significant problem. In the old codeplex site it was common for people new to TypeScript to file bugs because they couldn't understand why code like the snippet below would compile;

var fullName: string;

name = 'John Smith';
@mhegazy

This comment has been minimized.

Copy link

commented Aug 21, 2014

@NoelAbrahams the idea of splitting lib.d.ts is that node.d.ts would take dependency on lib.core.d.ts and not the normal lib, then when you reference node.d.ts you do not get any dom types as you would expect.

For this issue, we need two things:

  • a command line switch to allow you to specify a specific lib
  • some notion of search paths, so that when you add /// it knows you mean the one in the folder next to the compiler.
@mhegazy

This comment has been minimized.

Copy link

commented Feb 20, 2016

this should be covered by the proposal in #6974

@mhegazy mhegazy closed this Feb 20, 2016

@mhegazy mhegazy added Duplicate and removed In Discussion labels Feb 20, 2016

@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.