dweber019 / backstage-plugins

A collection of Backstage plugins
MIT License
28 stars 8 forks source link

yarn tsc error when bumping backstage to 1.32.1 #76

Closed nia-potato closed 1 week ago

nia-potato commented 2 weeks ago

Hi @dweber019 thanks for the great plugin!

btw I am getting this error when running yarn tsc

packages/app/src/App.tsx:147:3 - error TS2322: Type '(Partial<import("/var/gitlabrunner/buildbot/workspace/builds/z3Qtt7Xp/0/corp/backstage/src/node_modules/@dweber019/backstage-plugin-simple-icons/node_modules/@backstage/core-app-api/dist/index").AppIcons> & { ...; }) | undefined' is not assignable to type '(Partial<import("/var/gitlabrunner/buildbot/workspace/builds/z3Qtt7Xp/0/corp/backstage/src/node_modules/@backstage/core-app-api/dist/index").AppIcons> & { ...; }) | undefined'.
  Type 'Partial<AppIcons> & { [x: string]: IconComponent; }' is not assignable to type '(Partial<AppIcons> & { [x: string]: IconComponent; }) | undefined'.
147   icons: simpleIconsColor,

is this expected?

dweber019 commented 2 weeks ago

I don't think so, at least I don't get the error in this repo. Do you have more information like TS version and so on.

mattthym commented 2 weeks ago

I upgraded our Backstage instance yesterday as well and can confirm that something went awry with the plugin.

I simply ran the upgrade command and changed nothing else:

yarn backstage-cli versions:bump
yarn run v1.22.22
$ tsc
packages/app/src/App.tsx:87:3 - error TS2322: Type '(Partial<import("/home/mathym/Development/work/developer-portal/node_modules/@dweber019/backstage-plugin-simple-icons/node_modules/@backstage/core-app-api/dist/index").AppIcons> & { ...; }) | undefined' is not assignable to type '(Partial<import("/home/mathym/Development/work/developer-portal/node_modules/@backstage/core-app-api/dist/index").AppIcons> & { [x: string]: import("/home/mathym/Development/work/developer-portal/node_modules/@backstage/core-plugin-api/dist/index").IconComponent; }) | undefined'.
  Type 'Partial<AppIcons> & { [x: string]: IconComponent; }' is not assignable to type '(Partial<AppIcons> & { [x: string]: IconComponent; }) | undefined'.

87   icons: simpleIcons,
     ~~~~~

Found 1 error in packages/app/src/App.tsx:87
λ cat backstage.json
{
  "version": "1.32.2"
}

Using the default tsconfig.json and package.json of Backstage:

{
  "extends": "@backstage/cli/config/tsconfig.json",
  "include": [
    "packages/*/src",
    "plugins/*/src",
    "plugins/*/dev",
    "plugins/*/migrations"
  ],
  "exclude": ["node_modules"],
  "compilerOptions": {
    "outDir": "dist-types",
    "rootDir": "."
  }
}
{
  "name": "root",
  "version": "1.0.0",
  "private": true,
  "engines": {
    "node": "18 || 20"
  },
  "scripts": {
    "dev": "concurrently \"yarn start\" \"yarn start-backend\"",
    "start": "yarn workspace app start",
    "start-backend": "yarn workspace backend start",
    "build:backend": "yarn workspace backend build",
    "build:all": "backstage-cli repo build --all",
    "build-image": "yarn workspace backend build-image",
    "tsc": "tsc",
    "tsc:full": "tsc --skipLibCheck false --incremental false",
    "clean": "backstage-cli repo clean",
    "test": "backstage-cli repo test",
    "test:all": "backstage-cli repo test --coverage",
    "test:e2e": "playwright test",
    "fix": "backstage-cli repo fix",
    "lint": "backstage-cli repo lint --since origin/main",
    "lint:all": "backstage-cli repo lint",
    "prettier:check": "prettier --check .",
    "new": "backstage-cli new --scope internal"
  },
  "workspaces": {
    "packages": [
      "packages/*",
      "plugins/*"
    ]
  },
  "devDependencies": {
    "@backstage/cli": "^0.28.0",
    "@backstage/e2e-test-utils": "^0.1.1",
    "@playwright/test": "^1.32.3",
    "@spotify/prettier-config": "^12.0.0",
    "concurrently": "^8.0.0",
    "lerna": "^7.3.0",
    "node-gyp": "^10.0.0",
    "prettier": "^2.3.2",
    "typescript": "~5.4.0"
  },
  "resolutions": {
    "@types/react": "^18",
    "@types/react-dom": "^18"
  },
  "prettier": "@spotify/prettier-config",
  "lint-staged": {
    "*.{js,jsx,ts,tsx,mjs,cjs}": [
      "eslint --fix",
      "prettier --write"
    ],
    "*.{json,md}": [
      "prettier --write"
    ]
  }
}
dweber019 commented 1 week ago

Having a hard time to reproduce this but changed to a simpler type definition in https://github.com/dweber019/backstage-plugins/pull/78

dweber019 commented 1 week ago

@mattthym are you sure your on the latest update with all changes from the upstream backstage project as I can see differences in the yarn scripts like https://github.com/backstage/backstage/blob/master/packages/create-app/templates/default-app/package.json.hbs#L9

mattthym commented 1 week ago

Thanks for fixing, @dweber019! :bouquet: