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

Add an option to skip ///<reference> check on d.ts files #9945

Closed
saschanaz opened this issue Jul 26, 2016 · 5 comments
Closed

Add an option to skip ///<reference> check on d.ts files #9945

saschanaz opened this issue Jul 26, 2016 · 5 comments
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@saschanaz
Copy link
Contributor

saschanaz commented Jul 26, 2016

Related SO: http://stackoverflow.com/questions/38567936/can-typescript-module-reference-chain-be-ignored

Some libraries have jQuery or node.js support on them and the corresponding type definitions have references to jquery.d.ts and node.d.ts.

Below is an example with jsdom.d.ts:

/// <reference path='../node/node.d.ts' />
/// <reference path='../jquery/jquery.d.ts' />

import EventEmitter = NodeJS.EventEmitter;
export interface VirtualConsole extends EventEmitter {
  sendTo(console: Console): VirtualConsole;
}

export function jQueryify(window: Window, jqueryUrl: string, callback: (window: Window, jquery: JQuery) => any): void;

I want to skip node.d.ts and jquery.d.ts as I don't need them. Just excluding those files from project raises TS2304 Cannot find name, TS2503 Cannot find namespace, and TS6053 File not found. --skipLibCheck on TS 2.0 Suppresses TS2304 and TS2503 but not TS6053, so I want a new option to also suppress TS6053.

@saschanaz saschanaz changed the title Add an option to skip ///<reference> check Add an option to skip ///<reference> check on d.ts files Jul 26, 2016
@basarat
Copy link
Contributor

basarat commented Jul 26, 2016

I'd image that any error originating form a lib definition will be surpressed with skipLibCheck. Don't want to ignore invalid file references that are not in the lib area.

@saschanaz
Copy link
Contributor Author

saschanaz commented Jul 26, 2016

@basarat I think some people still want to ensure that they have all required files so that they do not meet unexpected any type. Skipping type check means a dev trusts a type definition but does not always mean the dev self-trusts.

I would like it, however :D

@RyanCavanaugh
Copy link
Member

Isn't this basically the same as --noResolve?

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Oct 24, 2016
@saschanaz
Copy link
Contributor Author

#7432 (comment)

if you do not want the compiler to resolve any files for you, use --noResolve. but that means that all your modules will not be resolved.

I want to resolve existing modules and ignore others. However, probably I will now just use @types and will not bother.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 25, 2016

My recommendation is to not use /// <reference path=".." /> or /// <reference types=".." /> all together; instead use your tsconfig.json to control what files are picked and where they are found, there are a large set of options to enable this including types, typeRoots, paths, rootDirs, and baseUrl.

@mhegazy mhegazy closed this as completed Feb 28, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

4 participants