Skip to content

Document<T = any> in index.d.ts breaks schema.create() #9928

@tatupesonen

Description

@tatupesonen

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Currently, Object.create() doesn't provide type completion except for the _id field.
Previously Document was set a class Document, now it is class Document<T = any>
The change happened in this commit

class Document<T = any> {

Last working version I tried this was with 5.11.7

If the current behavior is a bug, please provide the steps to reproduce.

Install 5.11.16, try to use schema.create(), types will be missing.

{
    "compilerOptions": {
        "allowJs": false,
        "module": "commonjs",
        "esModuleInterop": true,
        "target": "es5",
        "noImplicitAny": true,
        "skipLibCheck": true,
        "resolveJsonModule": true,
        "moduleResolution": "node",
        "sourceMap": true,
        "outDir": "dist",
        "baseUrl": ".",
        "paths": {
            "@typeDefs/*": [
                "../shared/*"
            ],
        }
    },
    "include": [
        "src/**/*"
    ],
    "references": [
        {
            "path": "../shared"
        }
    ]
}

What is the expected behavior?
Editor provides types

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node v15.8.0, Mongoose 5.11.16, no database registered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    typescriptTypes or Types-test related issue / Pull Request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions