Skip to content

Emitted definitions contain undocumented /// <reference types= #11634

@berickson1

Description

@berickson1

TypeScript Version: 2.0.0
I'm working on a module that imports react via @types. Upon compilation, I also emit definition files. The consumer of this package may or may not be using @types support. When I try consuming this module from a typescript project that doesn't use @types, I get the following error:
(1,1): error TS2304: Cannot find name 'react'.

It appears that this is due to definition creation emitting an @types specific reference in the generated .d.ts.

  1. Is there any way to suppress this reference in the output?
  2. Is this expected behaviour? It seems that I should be able to create a module written in typescript & emit definitions and make the consumer be responsible for having the relevant compatible typings available for a module.

Code

/// <reference types="react" />

Expected behavior:
Able to use module without @types support in the consumer

Actual behavior:
Compilation Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions