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

server backend build fails #400

Closed
sancelot opened this issue Apr 4, 2024 · 4 comments
Closed

server backend build fails #400

sancelot opened this issue Apr 4, 2024 · 4 comments
Assignees
Labels

Comments

@sancelot
Copy link
Contributor

sancelot commented Apr 4, 2024

Describe the bug
when building the backend , I have got an unexpected error.
I don't really understand since the backend works in development mode.
I suppose it is related to db entities.

I have not used a db, I am at the moment using json db

my entities are as follow :

import { Entity, Fields } from "remult";

@Entity("Features", {
  allowApiCrud: true,
})
export class Features {
  @Fields.cuid()
  id = "";

  @Fields.number()
  deltaA = 0;

  @Fields.number()
  Axis_0_2_Speed = 0;


  @Fields.createdAt()
  createdAt = new Date();
}

node_modules/remult/src/remult3/RepositoryImplementation.d.ts:193:5 - error TS2416: Property 'entityRef' in type 'FieldRefImplementation<entityType, valueType>' is not assignable to the same property in base type 'FieldRef<entityType, valueType>'.
Type 'EntityRef' is not assignable to type 'EntityRef'.
Types of property 'fields' are incompatible.
Type 'FieldsRef' is not assignable to type 'FieldsRef'.
Type 'FieldsRef' is not assignable to type 'FieldsRefBase'.
The types of 'find(...).entityRef.fields' are incompatible between these types.
Type 'FieldsRef' is not assignable to type 'FieldsRef'.
Type 'FieldsRef' is not assignable to type '{ [Properties in keyof MembersOnly]: NonNullable<entityType[Properties]> extends { id?: string | number; } ? IdFieldRef<entityType, entityType[Properties]> : FieldRef<...>; }'.

193 entityRef: EntityRef;
~~~~~~~~~
To Reproduce
tsc -p tsconfig.server.json

Expected behavior
a dist build

Screenshots

Desktop (please complete the following information):

  • OS: windows 10
    Node v20.11.0

Additional context

@noam-honig
Copy link
Collaborator

Hi @sancelot , can you share with me the repo where you get this issue? my github handle is noamhonig

If not, can you create a small repo based on the tutorial where you can see this issue - I would be happy to see it first hand and solve it

@noam-honig
Copy link
Collaborator

noam-honig commented Apr 5, 2024

Hi @sancelot, Sorry about that - I reviewed the issue and we're working on a fix that we'll probably be releasing next week, hopefully :)

In the meantime, please add the "skipLibCheck": true, setting to the server tsconfig

// tsconfig.server.json

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "outDir": "dist",
    "skipLibCheck": true, // <- add this please 
    "rootDir": "src"
  },
  "include": ["src/server/**/*", "src/shared/**/*"]
}

@sancelot
Copy link
Contributor Author

sancelot commented Apr 5, 2024

@noam-honig , thanks for your prompt reply. your fix is working :-)

@noam-honig
Copy link
Collaborator

Perfect - I also released a new version that should solve this issue (And added an automatic integration test to make sure it never happens again :)

You can try version:
0.25.8

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

No branches or pull requests

3 participants