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

Extract primitive property types of nested type #1715

Open
2 tasks
Zoggit8925 opened this issue Nov 8, 2024 · 1 comment
Open
2 tasks

Extract primitive property types of nested type #1715

Zoggit8925 opened this issue Nov 8, 2024 · 1 comment

Comments

@Zoggit8925
Copy link

Zoggit8925 commented Nov 8, 2024

Sorting

  • I'm submitting a bug

    • bug report
    • feature request
    • [ x] support request
  • I confirm that I

    • [x ] used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

I want to provide a type for an endpoint that dont use all relations in the schema of the ORM. So i need to extract all primitive types (NonRelationalMembers ) and nest the type of the relational members manualy

export type BaseProps = string | number | boolean | symbol | bigint | null | Date | undefined ;

export type UserProject = { projectTeams: { projectDetail: Extract<ProjectDetail,BaseProps>; } & Extract<ProjectTeam,BaseProps>[]; } & Extract<Contact,BaseProps>;

or

image

Current Behavior

tsoa cannot resolve the type.

There was a problem resolving type of 'Extract<ProjectDetail, BaseProps>'. There was a problem resolving type of 'UserProject'. Generate routes error. GenerateMetadataError: Unknown type: NeverKeyword At unknown position... This was caused by '<unknown name>' at TypeResolver.resolve (C:\Data\space\PWX_Taskmanagement\mis-scf-nodets-pwx-data\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:292:90) at TypeResolver.resolve (C:\Data\space\PWX_Taskmanagement\mis-scf-nodets-pwx-data\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:269:106) at ReferenceTransformer.transform (C:\Data\space\PWX_Taskmanagement\mis-scf-nodets-pwx-data\node_modules\@tsoa\cli\dist\metadataGeneration\transformer\referenceTransformer.js:66:168) at calcReferenceType (C:\Data\space\PWX_Taskmanagement\mis-scf-nodets-pwx-data\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:740:99) at TypeResolver.getReferenceType (C:\Data\space\PWX_Taskmanagement\mis-scf-nodets-pwx-data\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:759:24) at TypeResolver.resolveTypeReferenceNode (C:\Data\space\PWX_Taskmanagement\mis-scf-nodets-pwx-data\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:468:21) at TypeResolver.resolve (C:\Data\space\PWX_Taskmanagement\mis-scf-nodets-pwx-data\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:293:21) at C:\Data\space\PWX_Taskmanagement\mis-scf-nodets-pwx-data\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:120:118 at Array.reduce (<anonymous>) at TypeResolver.resolve (C:\Data\space\PWX_Taskmanagement\mis-scf-nodets-pwx-data\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:119:85)

Context (Environment)

Version of the library: ^6.5.1
Version of NodeJS: ^18
Version of ts: ^4.9.5

Update

there is an Workaround for the problem or a possible solution

image
image

Copy link

github-actions bot commented Nov 8, 2024

Hello there Zoggit8925 👋

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant