You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type 'LeanDocument<Sheet & Document<any, any>>' is not assignable to type 'Sheet'.
Types of property 'search' are incompatible.
Type 'LeanDocument<SheetSavedSearch>[]' is not assignable to type 'SheetSavedSearch[]'.
Type 'LeanDocument<SheetSavedSearch>' is not assignable to type 'SheetSavedSearch'.
Types of property 'searchCriteria' are incompatible.
Type 'LeanDocument<SearchCriteria[]>[]' is not assignable to type 'SearchCriteria[][]'.
Type 'LeanDocument<SearchCriteria[]>' is missing the following properties from type 'SearchCriteria[]': [Symbol.iterator], [Symbol.unscopables]ts(2322)
Did i do something wrong on schema declaration?
nodejs: 12.19.0
mongodb: 4.2.7
mongoose: 5.12.11
The text was updated successfully, but these errors were encountered:
before I attempt to repro this, try swapping the position of your two schemas. SheetSavedSearchSchema is used before it is declared so that could be causing your problem. Also, if the problem still persists please include other things not defined like the search criteria schema
import{Model,Schema}from'mongoose';interfaceITest{name: string;arrayOfArray: string[][];// <-- Array of Array}consttestSchema=newSchema<ITest,Model<ITest>>({name: {type: String,required: true,},arrayOfArray: [[String]],});testSchema.methods.getArrayOfArray=function(): string[][]{// <-- function to return Array of Arrayconsttest=this.toObject();returntest.arrayOfArray;// <-- error here};
And its error message:
Type 'LeanDocument<string[]>[]' is not assignable to type 'string[][]'.
Type 'LeanDocument<string[]>' is missing the following properties from type 'string[]': [Symbol.iterator], [Symbol.unscopables]ts(2322)
Hi,
The type LeanDocument seems not working for Array of Array.
I have some source codes like that:
And I get its LeanDocument by function toObject:
However, the type error occurs:
Did i do something wrong on schema declaration?
nodejs: 12.19.0
mongodb: 4.2.7
mongoose: 5.12.11
The text was updated successfully, but these errors were encountered: