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.
- Is there any way to suppress this reference in the output?
- 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
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.
Code
/// <reference types="react" />Expected behavior:
Able to use module without @types support in the consumer
Actual behavior:
Compilation Error