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

Fresh install does not compile #936

Closed
danielyogel opened this issue Aug 15, 2021 · 5 comments · Fixed by #1500
Closed

Fresh install does not compile #936

danielyogel opened this issue Aug 15, 2021 · 5 comments · Fixed by #1500
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@danielyogel
Copy link

Description
Fresh install does not compile with the following compile time error:

Type alias 'TDescendant' circularly references itself.

Steps

  1. Init a fresh TypeScript Vite project.
  2. Follow Plate's install guide
  3. Run tsc
@danielyogel danielyogel added the bug Something isn't working label Aug 15, 2021
@MingkunHe
Copy link

any update? I got this issue too

@fondation451
Copy link
Contributor

Do we know the cause of this compilation problem? I am using Plate on a frontend application and it works perfectly well. But in my backend code, I got this issue too on.

Here is my backend dependencies:

"dependencies": {
    "@elastic/elasticsearch": "^7.8.0",
    "@nestjs/common": "^7.0.0",
    "@nestjs/core": "^7.0.0",
    "@nestjs/platform-express": "^7.0.0",
    "@sentry/node": "5.20.1",
    "@slack/web-api": "^5.11.0",
    "@types/draft-js": "^0.11.6",
    "@types/faker": "^4.1.12",
    "@types/jsonwebtoken": "^8.5.0",
    "@types/lodash": "^4.14.158",
    "@types/nock": "^11.1.0",
    "@udecode/plate-basic-elements": "^6.4.0",
    "@udecode/plate-basic-marks": "^6.4.0",
    "@udecode/plate-common": "^6.4.0",
    "@udecode/plate-html-serializer": "^6.4.0",
    "@udecode/plate-link": "^6.4.0",
    "@udecode/plate-list": "^6.4.0",
    "atlassian-jwt": "^2.0.1",
    "aws-sdk": "^2.709.0",
    "axios": "^0.21.2",
    "cld": "^2.7.0",
    "dotenv": "npm:dotenv-override@^5.0.1",
    "dotenv-cli": "^4.0.0",
    "draft-js": "^0.11.7",
    "faker": "^4.1.0",
    "google-auth-library": "^6.0.2",
    "grapheme-splitter": "^1.0.4",
    "helmet": "^4.4.1",
    "jsdom": "^18.0.0",
    "jsonwebtoken": "^8.5.1",
    "lodash": "^4.17.19",
    "messageformat": "^2.3.0",
    "mixpanel": "^0.13.0",
    "moment": "^2.27.0",
    "nest-raven": "^7.0.0",
    "node-mailjet": "^3.3.4",
    "pdfjs-dist": "^2.10.377",
    "pg": "^8.2.1",
    "pino": "^6.4.1",
    "pusher": "^5.0.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^6.5.4",
    "slate": "^0.66.5",
    "slate-history": "^0.66.0",
    "slate-hyperscript": "^0.67.0",
    "slate-react": "^0.69.0",
    "source-map-support": "^0.5.19",
    "sqreen": "^1.61.0",
    "timekeeper": "^2.2.0",
    "typeorm": "^0.2.25",
    "uuid": "^8.2.0",
    "validator": "^13.5.2"
  },
  "devDependencies": {
    "@nestjs/cli": "^7.0.0",
    "@nestjs/schematics": "^7.0.0",
    "@nestjs/testing": "^7.0.0",
    "@types/aws-sdk": "^2.7.0",
    "@types/dotenv": "^8.2.0",
    "@types/express": "^4.17.3",
    "@types/glob": "^7.1.4",
    "@types/immutable": "^3.8.7",
    "@types/jest": "25.1.4",
    "@types/jsdom": "^16.2.13",
    "@types/mixpanel": "^2.14.2",
    "@types/node": "^13.9.1",
    "@types/node-mailjet": "^3.3.4",
    "@types/pino": "^6.3.9",
    "@types/request": "^2.48.6",
    "@types/supertest": "^2.0.8",
    "@types/uuid": "^8.3.1",
    "@types/validator": "^13.1.3",
    "@typescript-eslint/eslint-plugin": "^2.23.0",
    "@typescript-eslint/parser": "^2.23.0",
    "eslint": "^6.8.0",
    "eslint-config-prettier": "^6.10.0",
    "eslint-plugin-import": "^2.24.2",
    "husky": "^7.0.1",
    "jest": "^25.1.0",
    "nock": "^13.0.5",
    "nodemon": "^2.0.6",
    "npm-run-all": "^4.1.5",
    "pino-pretty": "^5.1.2",
    "prettier": "^1.19.1",
    "supertest": "^4.0.2",
    "ts-jest": "25.2.1",
    "ts-loader": "^6.2.1",
    "ts-node": "^9.0.0",
    "ts-node-dev": "^1.1.1",
    "typescript": "^4.4.4"
  },

Do you have any updates?

@explodingunicorn
Copy link

Also running into this issue.

@zbeyens zbeyens added the help wanted Extra attention is needed label Dec 6, 2021
@camille-wintz
Copy link

This issue seems to be caused by the @ts-ignore in this file:

https://github.com/udecode/plate/blob/main/packages/core/src/types/slate/TDescendant.ts#L5

@ts-ignore is not copied into generated d.ts files: microsoft/TypeScript#38628

This means the source will build, but running tsc in a project importing plate won't build. The issue isn't present with webpack (but is present with rollup and vite) because ts-loader doesn't run tsc at the project root.

@zbeyens
Copy link
Member

zbeyens commented Apr 21, 2022

@camille-wintz We have this error because we're using generics to extend the type. The workaround is to use interfaces but then the union type (Element | Text) gets broken as it works only with types.

It would probably wise to get rid of Plate T... types and push for ianstormtaylor/slate#4177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants