Closed arolson101 closed 3 years ago
This Object interface expansion also cause another bug. Typescript compiler adds
/// <reference types="chai">
to all d.ts generated based on sources containing Object
. (E.g. https://github.com/angular-redux/ng2-redux/pull/209/files)
I think it is better to eliminate polution Object interface with should
property and make separate version of typings for those who need should
assertion syntax.
It also breaks my compilation process because I have typings for Elasticsearch Search body requests. It has an internal interface
export interface Bool {
should?: Query | Query[];
filter?: Query | Query[];
must?: Query | Query[];
must_not?: Query | Query[];
}
And when I try to build an object with
const b: Bool = { should: query }
I get a type error saying that Query
and Assertion
are incompatible.
I agree with @nikolaymatrosov that we should not pollute the Object interface by default and I'm going to make a PR removing that last bit.
I couldn't manage a feasible PR because I tried to make it happen in the existing @types/chai package, but now I think we should instead create an alternatives types library that is exactly the same but doesn't contain the Object declaration.
Hi thread, we're moving DefinitelyTyped to use GitHub Discussions for conversations the @types
modules in DefinitelyTyped.
To help with the transition, we're closing all issues which haven't had activity in the last 6 months, which includes this issue. If you think closing this issue is a mistake, please pop into the TypeScript Community Discord and mention the issue in the definitely-typed
channel.
chai/chai.d.ts
file in this repo and had problems.chai/chai.d.ts
.The bit at the end of chai.d.ts:
breaks tsx support because it thinks that all objects must have a
should
property (specifically, " Property 'should' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<..."). It should be: