Type Document seem to be not combitable with other interfaces
See original GitHub issueThis is the Document type.
type Document<T> = DocumentLike & {
[key in keyof T]: T[key]
}
It is supposed to accept any objects { } with appropriate values. See the example below
interface IName { name: string }
let testObj: IName = { name: 'Aora' }
idx.addAdocuments([ testObj ]) // error!
This isn’t making any sense. Because if I remove the interface (IName) of testObj, this suddenly works just fine. That means it works as it is supposed to. So what’s up with the type error?
Type 'IName' is not assignable to type 'Document<any>'.
Type 'IName' is not assignable to type 'DocumentLike'.
Index signature is missing in type 'IName'.ts(2322)
Another great example would the README.md file
const documents = [
{ book_id: 123, title: 'Pride and Prejudice' },
...
]
Here each object can be given an interface like
interface IBook {book_id: number, title: string}
const documents = [
{ book_id: 123, title: 'Prejudice' } as IBook,
...
]
And as you expect, using this in the addDocuments function produces the same error. Pardon me if I’m wrong somewhere.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Implementing Incompatible Interfaces - java - Stack Overflow
I am trying to build a class that implements Queue and Map . Both interfaces define the remove(Object) method, but with different return...
Read more >Everything you wanted to know about interfaces, but were ...
Topics covered include: Understand what constitutes an interface, how to identify interfaces, how to define and document interface definitions, what constitutes ...
Read more >Allow extending multiple interfaces with different, but ... - GitHub
Interface 'SomeChange' cannot simultaneously extend types 'Change' and 'SomeChangeExtension'. Named property 'type' of types 'Change' and ' ...
Read more >How to troubleshoot damaged documents in Word - Office
Method 3: Create a link to the damaged document. Step 1: Create blank document. In Word, select the File Menu, and then select...
Read more >Interface Compatibility - Linker and Libraries Guide
Interface Compatibility. Many types of change can be made to an object. In their simplest terms, these changes can be categorized into one...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hello @bidoubiwa, sorry for the delayed answer, same for me in holidays last week. I definitely want to take a peek at this issue as I worked on those types. I’ll send a PR by the end of the week and let you know if I ever have an impediment working on this issue 🙏
Hey @emyann, If you have no time to resolve this, which is not a problem! Could you tell me so someone else can be assigned to this issue?