Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import error when using an inferred data tape #13710

Closed
1 task done
daniel-ortiz-yepes opened this issue Aug 9, 2023 · 5 comments
Closed
1 task done

Import error when using an inferred data tape #13710

daniel-ortiz-yepes opened this issue Aug 9, 2023 · 5 comments
Labels
help wanted help This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary Stale

Comments

@daniel-ortiz-yepes
Copy link

Prerequisites

  • I have written a descriptive issue title

Mongoose version

6.7.3

Node.js version

18.16.0

MongoDB version

6

Operating system

None

Operating system version (i.e. 20.04, 11.3, 10)

Win10

Issue

Hello Mongoose Team,

I am trying to create a simple model derived from a Schema and an auto inferred type. To this end I am following the example code from the "schemas in typeScript" page.

I am using a very similar piece of code, but the IDE is complaining about having problems with the import of InferSchemaType


import getTmtAtlasModel from "apps/tmt/server/adapters/realImplementations/tmsAtlasReal";

const testSchema = new Schema({
    info: String,
});

type TestTmt = InferSchemaType<typeof testSchema>;

The compiler says "Cannot resolve symbol 'InferSchemaType'"
image

I see that there is a definition of InferSchemaType:

type InferSchemaType<TSchema> = IfAny<TSchema, any, ObtainSchemaGeneric<TSchema, 'DocType'>>;

but this definition is not being exported. What can I do in this case?

@daniel-ortiz-yepes daniel-ortiz-yepes added help This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary help wanted labels Aug 9, 2023
@vkarpov15
Copy link
Collaborator

Does TypeScript fail to compile? Or is this an IDE issue?

@daniel-ortiz-yepes
Copy link
Author

Hi Valeri,

good question. I would say this is an IDE issue with Intellij, because I tried the same code with VSCode and I do not see the error.

But still is there any reason why InferSchemaType is not exported?

@vkarpov15
Copy link
Collaborator

Opened a PR #13737 to see. I don't have a good reason to not export InferSchemaType.

vkarpov15 added a commit that referenced this issue Aug 15, 2023
@github-actions
Copy link

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Aug 29, 2023
@github-actions
Copy link

github-actions bot commented Sep 3, 2023

This issue was closed because it has been inactive for 19 days and has been marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted help This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary Stale
Projects
None yet
Development

No branches or pull requests

2 participants