Skip to content

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

Description

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.

Activity

  1. changed the title [-]Add an option to skip ///<reference> check[/-] [+]Add an option to skip ///<reference> check on d.ts files[/+] on Jul 26, 2016
  2. basarat commented on Jul 26, 2016

    @basarat
    Contributor

    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.

  3. saschanaz commented on Jul 26, 2016

    @saschanaz
    ContributorAuthor

    Basarat Ali Syed (@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

  4. RyanCavanaugh commented on Oct 24, 2016

    @RyanCavanaugh
    Member

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

  5. saschanaz commented on Oct 25, 2016

    @saschanaz
    ContributorAuthor

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

  6. mhegazy commented on Oct 25, 2016

    @mhegazy
    Contributor

    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.

  7. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions