Repository navigation
/// <reference types="xxx" /> from packages introduce collisions #12040
Description
Activity
What I tried was to set
typeRootsto another directory where I kept that modified 'es6-shim.d.ts' with removed PropertyKey, but compiler is persistent that I have to have es6-shim.d.ts in Types (@types) directory.What I also tried was to set
typesto only interesting types such as ['React']Package that I use requires "es6-shim" as following /// .
why? is it a hard dependency on
es6-shims? looks to me that this is not the case, as you can use the library without es6-shims. so the fix would be to remove this dependency declaration from you other package. feel free to send a PR to DefinitelyTyped, and i will get it in.removed PropertyKey, but compiler is persistent that I have to have es6-shim.d.ts in Types (@types) directory.
how so? can you share more details.
What I also tried was to set types to only interesting types such as ['React']
This is a dependency of your other package. it needs to be satisfied to make it work.
- addedNeeds More InfoThe issue still hasn't been fully clarifiedThe issue still hasn't been fully clarified@typesRelates to working with .d.ts files (declaration/definition files) from DefinitelyTypedRelates to working with .d.ts files (declaration/definition files) from DefinitelyTyped
on Nov 7, 2016 The package name is the popular react-apollo that brings graphql support and is built with typescript. What happens is that the package is built with "definitions". And definitions have the
/// <reference types="es6-shim" />automatically added by typescript compiler.This is how one of the
.d.tsfiles looks like:/// <reference types="react" /> /// <reference types="chai" /> /// <reference types="typed-graphql" /> /// <reference types="node" /> /// <reference types="es6-shim" /> import * as React from 'react'; ....
I have not found any way of fighting back against this, only manually removing the "shim" reference in my node_modules, but as you can imagine this is not possible in CI.
Reacted by John WeiszI have not found any way of fighting back against this, only manually removing the "shim" reference in my node_modules, but as you can imagine this is not possible in CI.
you should be able to override any declaration package using typeRoots. e..g create a new empty file
overrideTypings\es6-shims\index.d.ts, then settypeRootsto be["overrideTypeings", "node_modules\@types"].Mohamed Hegazy (@mhegazy) thanks for your help! It took me awhile to realise how complete answer you gave me, as I have initially created my file as
overrideTypings/es6-shim.d.tsnotoverrideTypings/es6-shim/index.d.ts. With a little help from--traceResolutionflag I realised what my problem was.THANKS! 🌹
Glad this was resolved. but i want to emphasize that the main issue here is on the package side (caused by a compiler bug). Overriding declaration packages, though possible, is not the best possible solution.
- locked and limited conversation to collaborators
on Jun 19, 2018
TypeScript Version: nightly (2.1.0-dev.201xxxxx)
The problem here is related to #11671
Package that I use requires "es6-shim" as following
/// <reference types="es6-shim" />.This REQUIRES me to install @types/es6-shim otherwise I get an error
My project is ES6 based. As a result, after I install that dependency, I get following error during compilation:
No matter what I set to
typesproperty or totypeRootsthe error will never go away, unless I manually delete the 'PropertyKey' definition in the es6-shim.d.ts file. While this is ok in local, it PROHIBITS CI, as the project will never compile on CI serverWhat can I do in this case? Is there any way I can protect myself from these errors?