Skip to content

@types/node lib definitions getting referenced for projects targeting browser #462

@mashenoy

Description

@mashenoy

Package Version: _______

  • nodejs
    • nodejs version: ______
    • os name/version: _____
  • browser
    • name/version: all
      Describe the bug
      Adding @azure/ms-rest-package automatically adds @types/node type definitions. We are working on a React/Typescript project which targets es5 and adding ms-rest-js reference internally pulls in @types/node which pulls in library definitions for es2018

Due to this typescript compiler does not fail the build if newer ES features are used while targeting older ES runtimes.

Screenshots
Enabling "explainFiles" in typescript configs shows @types/node is added by 'node_modules/@azure/ms-rest-js/es/lib/webResource.d.ts' file.

image
image

To Reproduce

  1. Go to replit (https://replit.com/@mashenoy/ms-rest-js-sample) (You will need to fork the repl)
  2. Run ./node_modules/.bin/tsc -p tsconfig.json in the shell.
  3. @types/node types is added by node_modules/@azure/ms-rest-js/es/lib/webResource.d.ts file (shown by explain files tsc compiler option)

Expected behavior
@azure/ms-rest-js should not pollute lib definitions of consuming applications.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions