Comments (5)
Hi, guys... I was facing the same error and noticed this happens when I ran this command npm i -D @types/chai
, so I uninstalled @types/chai in order to fix the problem, and works again.
from elastic-ts.
Yeah, it's a case with Chai.Assertion
polluting the global Object
interface. You can neutralize the effect in a declaration file, like so:
// global.d.ts
interface Object {
should?: any
}
from elastic-ts.
Hey thanks for opening this issue, I'm happy to take a look!
I think there may be additional code affecting those types. For instance, the TypeScript error mentions an Assertion
type - that type doesn't exist inside elastic-ts
, and may be coming from your app code or one of your dependencies.
If I paste your example into the test in elastic-ts
it does work.
So the key is probably looking more into what defines Assertion
and BoolQuery
in your app code. Feel free to share whatever you're able and I can investigate too.
from elastic-ts.
Ah, nice find @mgonzalez121690, yeah if you take a look at the very bottom of https://unpkg.com/browse/@types/[email protected]/index.d.ts, it looks like the chai types are adding a should
property to literally all objects via the Object
interface.
I'm not sure there's anything we can do about that here, chai adding that property to all object types is very broad.
Most likely if you still want to include @types/chai
in your project, you would want to adjust the types
property in your tsconfig.json
to not include @types/chai
for your main app code that uses elastic-ts
, and have a separate tsconfig.json
that you use for your tests. Something like:
tsconfig.json
{
"compilerOptions": {
"types": [] // or ["node"] etc, basically a list of global types to evaluate
}
}
tsconfig.test.json
{
"compilerOptions": {
"types": ["chai"] // or ["node", "chai"] etc
}
}
from elastic-ts.
I'm going to close this issue, but let me know if the above helps or if you're still experiencing issues!
from elastic-ts.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elastic-ts.