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

Type '{}' is not assignable to type 'ReactNode' with Bitbucket pipelines cache (works locally) -- need to specify @types/react-dom #309

Closed
mgo-af opened this issue Apr 13, 2022 · 3 comments
Labels
kind: support Asking for support with something or a specific use case scope: integration Related to an integration, not necessarily to core (but could influence core) solution: out-of-scope This is out of scope for this project solution: tsc behavior This is tsc's behavior as well, so this is not a bug with this plugin solution: workaround available There is a workaround available for this issue

Comments

@mgo-af
Copy link

mgo-af commented Apr 13, 2022

What happens and why it is wrong

[!] (plugin rpt2) Error: /opt/atlassian/pipelines/agent/build/[src/components/ThemeProvider/ThemeProvider.tsx](~src/components/ThemeProvider/ThemeProvider.tsx)(110,46): semantic error TS2322: Type 'React.ReactNode' is not assignable to type 'import("/opt/atlassian/pipelines/agent/build/node_modules/@types/styled-components/node_modules/@types/react/index").ReactNode'.
 
Type '{}' is not assignable to type 'ReactNode'. src/components/ThemeProvider/ThemeProvider.tsx

Locally, the build succeeds without any problems, but when included node caches in Bitbucket pipelines, the build fails.

After removing the cached node_modules in the Bitbucket pipelines script, the build succeeds in the container.

Any ideas why?

Environment

image: node:14.17.3
Versions

  npmPackages:
    rollup: ^2.61.1 => 2.67.0 
    rollup-plugin-typescript2: ^0.31.1 => 0.31.2 
    typescript: ^4.5.4 => 4.5.5 

rollup.config.js

`rollup.config.js`:
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from 'rollup-plugin-typescript2'
import postcss from 'rollup-plugin-postcss'
import {terser} from 'rollup-plugin-terser'
import visualizer from 'rollup-plugin-visualizer'

const packageJson = require('./package.json')

export default {
  input: 'src/index.ts',
  external: ['styled-components', 'react', 'react-dom'],
  output: [
    {
      file: packageJson.main,
      format: 'cjs',
      sourcemap: true
    },
    {
      file: packageJson.module,
      format: 'esm',
      sourcemap: true
    }
  ],
  plugins: [
    peerDepsExternal(),
    resolve(),
    commonjs(),
    typescript({useTsconfigDeclarationDir: true, verbosity: 3}),
    postcss({
      extensions: ['.css']
    }),
    terser(),
    visualizer({sourcemap: true, gzipSize: true, brotliSize: true, template: 'sunburst'})
  ]
}

tsconfig.json

`tsconfig.json`:
{
  "compilerOptions": {
    "target": "esnext",
    "module": "es2015",
    "outDir": "lib",
    "lib": ["dom", "dom.iterable", "esnext"],
    "declaration": true,
    "declarationDir": "lib",
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": false,
    "noEmit": true,
    "jsx": "react",
    "rootDirs": ["src"]
  },
  "include": ["src", "@types"],
  "exclude": ["node_modules", "lib"]
}

package.json

`package.json`:
{
  "main": "lib/index.js",
  "module": "lib/index.esm.js",
  "types": "lib/index.d.ts",
  "scripts": {
    "test": "jest",
    "storybook": "start-storybook -p 6006",
    "build-storybook": "build-storybook",
    "build": "rollup -c",
    "lint": "eslint '**/*.{js,ts,tsx}' --max-warnings=0",
    "lint:fix": "npm run lint -- --fix",
    "clear:babel-cache": "rimraf -rf ./node_modules/.cache/babel-loader/*"
  },
  "devDependencies": {
    "@babel/cli": "^7.16.7",
    "@babel/core": "^7.16.7",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
    "@babel/plugin-proposal-optional-chaining": "^7.16.7",
    "@babel/plugin-transform-modules-commonjs": "^7.16.8",
    "@babel/preset-env": "^7.16.8",
    "@babel/preset-react": "^7.16.7",
    "@babel/preset-typescript": "^7.16.7",
    "@babel/types": "^7.16.8",
    "@changesets/cli": "^2.20.0",
    "@rollup/plugin-commonjs": "^21.0.1",
    "@rollup/plugin-node-resolve": "^13.1.1",
    "@storybook/addon-a11y": "^6.4.14",
    "@storybook/addon-actions": "^6.4.14",
    "@storybook/addon-controls": "^6.4.14",
    "@storybook/addon-docs": "^6.4.14",
    "@storybook/addon-essentials": "^6.4.14",
    "@storybook/addon-links": "^6.4.14",
    "@storybook/react": "^6.4.14",
    "@testing-library/react": "^12.1.2",
    "@testing-library/react-hooks": "^7.0.2",
    "@testing-library/user-event": "^13.5.0",
    "@types/chroma-js": "^2.1.3",
    "@types/enzyme": "^3.10.11",
    "@types/jest": "^27.4.0",
    "@types/jest-axe": "^3.5.3",
    "@types/react": "^17.0.37",
    "@types/react-test-renderer": "^17.0.1",
    "@typescript-eslint/eslint-plugin": "^5.9.1",
    "@typescript-eslint/parser": "^5.9.1",
    "@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
    "babel-core": "^6.26.3",
    "babel-loader": "^8.2.3",
    "babel-plugin-add-react-displayname": "^0.0.5",
    "babel-plugin-macros": "^3.1.0",
    "babel-plugin-preval": "^5.0.0",
    "babel-plugin-styled-components": "^2.0.2",
    "babel-plugin-transform-replace-expressions": "^0.2.0",
    "babel-polyfill": "^6.26.0",
    "chroma-js": "^2.1.2",
    "chromatic": "^6.5.3",
    "csstype": "^3.0.10",
    "enzyme": "^3.11.0",
    "eslint": "^8.6.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.3.0",
    "jest": "^27.4.7",
    "jest-axe": "^5.0.1",
    "jest-styled-components": "^7.0.8",
    "lodash.isempty": "^4.4.0",
    "lodash.isobject": "^3.0.2",
    "postcss": "^8.4.5",
    "prettier": "^2.5.1",
    "prop-types": "^15.8.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-test-renderer": "^17.0.2",
    "rollup": "^2.61.1",
    "rollup-plugin-peer-deps-external": "^2.2.4",
    "rollup-plugin-postcss": "^4.0.2",
    "rollup-plugin-terser": "^7.0.2",
    "rollup-plugin-typescript2": "^0.31.1",
    "rollup-plugin-visualizer": "^5.6.0",
    "storybook-addon-performance": "^0.16.1",
    "ts-toolbelt": "^9.6.0",
    "typescript": "^4.5.4"
  },
  "peerDependencies": {
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "styled-components": "^5.3.3"
  },
  "dependencies": {
    "@styled-system/css": "^5.1.5",
    "@styled-system/props": "^5.1.5",
    "@styled-system/theme-get": "^5.1.2",
    "@types/styled-components": "^5.1.24",
    "@types/styled-system": "^5.1.15",
    "@types/styled-system__css": "^5.0.16",
    "@types/styled-system__theme-get": "^5.0.2",
    "deepmerge": "^4.2.2",
    "focus-visible": "^5.2.0",
    "styled-system": "^5.1.5"
  }
}

plugin output with verbosity 3

plugin output with verbosity 3:
> npm run build
> rollup -c

�[36m
�[1msrc/index.ts�[22m → �[1mlib/index.js, lib/index.esm.js�[22m...�[39m
rpt2: built-in options overrides: {
    "noEmitHelpers": false,
    "importHelpers": true,
    "noResolve": false,
    "noEmit": false,
    "inlineSourceMap": false,
    "outDir": "/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/placeholder",
    "moduleResolution": 2,
    "allowNonTsExtensions": true
}
rpt2: parsed tsconfig: {
    "options": {
        "target": 99,
        "module": 5,
        "outDir": "/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/placeholder",
        "lib": [
            "lib.dom.d.ts",
            "lib.dom.iterable.d.ts",
            "lib.esnext.d.ts"
        ],
        "declaration": true,
        "declarationDir": "/opt/atlassian/pipelines/agent/build/lib",
        "allowJs": true,
        "skipLibCheck": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "strict": true,
        "forceConsistentCasingInFileNames": true,
        "moduleResolution": 2,
        "resolveJsonModule": true,
        "isolatedModules": false,
        "noEmit": false,
        "jsx": 2,
        "rootDirs": [
            "/opt/atlassian/pipelines/agent/build/src"
        ],
        "configFilePath": "/opt/atlassian/pipelines/agent/build/tsconfig.json",
        "noEmitHelpers": false,
        "importHelpers": true,
        "noResolve": false,
        "inlineSourceMap": false,
        "allowNonTsExtensions": true
    },
    "fileNames": [
        REDACTING...
        "/opt/atlassian/pipelines/agent/build/src/utils/types/index.ts"
    ],
    "typeAcquisition": {
        "enable": false,
        "include": [],
        "exclude": []
    },
    "raw": {
        "compilerOptions": {
            "target": "esnext",
            "module": "es2015",
            "outDir": "lib",
            "lib": [
                "dom",
                "dom.iterable",
                "esnext"
            ],
            "declaration": true,
            "declarationDir": "lib",
            "allowJs": true,
            "skipLibCheck": true,
            "esModuleInterop": true,
            "allowSyntheticDefaultImports": true,
            "strict": true,
            "forceConsistentCasingInFileNames": true,
            "moduleResolution": "node",
            "resolveJsonModule": true,
            "isolatedModules": false,
            "noEmit": true,
            "jsx": "react",
            "rootDirs": [
                "src"
            ]
        },
        "include": [
            "src",
            "@types"
        ],
        "exclude": [
            "node_modules",
            "lib"
        ],
        "compileOnSave": false
    },
    "errors": [],
    "wildcardDirectories": {
        "/opt/atlassian/pipelines/agent/build/src": 1,
        "/opt/atlassian/pipelines/agent/build/@types": 1
    },
    "compileOnSave": false
}
rpt2: typescript version: 4.6.3
rpt2: tslib version: 2.3.1
rpt2: rollup version: 2.70.1
rpt2: rollup-plugin-typescript2 version: 0.31.2
rpt2: plugin options:
{
    "useTsconfigDeclarationDir": true,
    "verbosity": 3,
    "check": true,
    "clean": false,
    "cacheRoot": "/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2",
    "include": [
        "*.ts+(|x)",
        "**/*.ts+(|x)"
    ],
    "exclude": [
        "*.d.ts",
        "**/*.d.ts"
    ],
    "abortOnError": true,
    "rollupCommonJSResolveHack": false,
    "tsconfigOverride": {},
    "transformers": [],
    "tsconfigDefaults": {},
    "objectHashIgnoreUnknownHack": false,
    "cwd": "/opt/atlassian/pipelines/agent/build",
    "typescript": "version 4.6.3"
}
rpt2: rollup config:
{
    "input": "src/index.ts",
    "plugins": [
        {
            "name": "peer-deps-external"
        },
        {
            "name": "node-resolve",
            "version": "13.2.0"
        },
        {
            "name": "commonjs"
        },
        {
            "name": "rpt2"
        },
        {
            "name": "postcss"
        },
        {
            "name": "terser"
        },
        {
            "name": "visualizer"
        },
        {
            "name": "stdin"
        }
    ],
    "output": [
        {
            "file": "lib/index.js",
            "format": "cjs",
            "plugins": [],
            "sourcemap": true
        },
        {
            "file": "lib/index.esm.js",
            "format": "esm",
            "plugins": [],
            "sourcemap": true
        }
    ]
}
rpt2: tsconfig path: /opt/atlassian/pipelines/agent/build/tsconfig.json
rpt2: included:
[
    "/opt/atlassian/pipelines/agent/build/src/*.ts+(|x)",
    "/opt/atlassian/pipelines/agent/build/src/**/*.ts+(|x)"
]
rpt2: excluded:
[
    "/opt/atlassian/pipelines/agent/build/src/*.d.ts",
    "/opt/atlassian/pipelines/agent/build/src/**/*.d.ts"
]
rpt2: Ambient types:
rpt2:     /opt/atlassian/pipelines/agent/build/src/@types/jest-styled-components/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/colors/dark.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/colors/dark_colorblind.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/colors/dark_dimmed.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/colors/dark_high_contrast.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/colors/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/colors/light.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/colors/light_colorblind.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/colors/light_high_contrast.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/spacing/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/spacing/normal.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/typography/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/src/temporary/styles/dist/js/typography/normal.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/aria-query/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/babel__core/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/babel__generator/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/babel__template/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/babel__traverse/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/cheerio/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/chroma-js/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/color-convert/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/color-name/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/enzyme/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/estree/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/glob/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/graceful-fs/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/hast/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/hoist-non-react-statics/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/html-minifier-terser/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/is-ci/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/is-function/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/istanbul-lib-coverage/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/istanbul-lib-report/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/istanbul-reports/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/jest/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/jest-axe/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/json-schema/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/mdast/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/minimatch/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/minimist/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/node/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/node-fetch/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/normalize-package-data/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/npmlog/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/overlayscrollbars/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/parse-json/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/parse5/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/prettier/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/pretty-hrtime/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/prop-types/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/qs/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/react/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/react-dom/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/react-syntax-highlighter/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/react-test-renderer/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/resolve/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/scheduler/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/semver/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/source-list-map/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/stack-utils/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/styled-components/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/styled-system/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/styled-system__css/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/styled-system__theme-get/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/tapable/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/testing-library__jest-dom/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/uglify-js/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/unist/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/webpack/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/webpack-env/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/webpack-sources/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/yargs/index.d.ts
rpt2:     /opt/atlassian/pipelines/agent/build/node_modules/@types/yargs-parser/index.d.ts
rpt2: ambient types changed, redoing all semantic diagnostics
rpt2: transpiling '/opt/atlassian/pipelines/agent/build/src/index.ts'
rpt2:     cache: '/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/rpt2_3fa670c8c687de7a0da765d47606c1af21508ff3/code/cache/b4b0cb16c1f714e3560bdc3cf80b7a4a99602c63'
rpt2:     cache miss
rpt2:     cache: '/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/rpt2_3fa670c8c687de7a0da765d47606c1af21508ff3/syntacticDiagnostics/cache/b4b0cb16c1f714e3560bdc3cf80b7a4a99602c63'
rpt2:     cache miss
rpt2:     cache: '/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/rpt2_3fa670c8c687de7a0da765d47606c1af21508ff3/semanticDiagnostics/cache/b4b0cb16c1f714e3560bdc3cf80b7a4a99602c63'
rpt2:     cache miss
rpt2: generated declarations for '/opt/atlassian/pipelines/agent/build/src/index.ts'
rpt2: dependency '/opt/atlassian/pipelines/agent/build/src/theme.ts'
rpt2:     imported by '/opt/atlassian/pipelines/agent/build/src/index.ts'
rpt2: resolving './theme' imported by '/opt/atlassian/pipelines/agent/build/src/index.ts'
rpt2:     to '/opt/atlassian/pipelines/agent/build/src/theme.ts'
rpt2: dependency '/opt/atlassian/pipelines/agent/build/src/constants.ts'
rpt2:     imported by '/opt/atlassian/pipelines/agent/build/src/index.ts'
rpt2: resolving './constants' imported by '/opt/atlassian/pipelines/agent/build/src/index.ts'
rpt2:     to '/opt/atlassian/pipelines/agent/build/src/constants.ts'
rpt2: transpiling '/opt/atlassian/pipelines/agent/build/src/theme.ts'
rpt2:     cache: '/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/rpt2_3fa670c8c687de7a0da765d47606c1af21508ff3/code/cache/b554db9c2bd592b3709ec1f4ac11c764400c730b'
rpt2:     cache miss
rpt2:     cache: '/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/rpt2_3fa670c8c687de7a0da765d47606c1af21508ff3/syntacticDiagnostics/cache/b554db9c2bd592b3709ec1f4ac11c764400c730b'
rpt2:     cache miss
rpt2:     cache: '/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/rpt2_3fa670c8c687de7a0da765d47606c1af21508ff3/semanticDiagnostics/cache/b554db9c2bd592b3709ec1f4ac11c764400c730b'
rpt2:     cache miss
rpt2: generated declarations for '/opt/atlassian/pipelines/agent/build/src/theme.ts'
rpt2: transpiling '/opt/atlassian/pipelines/agent/build/src/constants.ts'
rpt2:     cache: '/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/rpt2_3fa670c8c687de7a0da765d47606c1af21508ff3/code/cache/27d5a8c58657dce37831f0158d70011bbc3bcf82'
rpt2:     cache miss
rpt2:     cache: '/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/rpt2_3fa670c8c687de7a0da765d47606c1af21508ff3/syntacticDiagnostics/cache/27d5a8c58657dce37831f0158d70011bbc3bcf82'
rpt2:     cache miss
rpt2:     cache: '/opt/atlassian/pipelines/agent/build/node_modules/.cache/rollup-plugin-typescript2/rpt2_3fa670c8c687de7a0da765d47606c1af21508ff3/semanticDiagnostics/cache/27d5a8c58657dce37831f0158d70011bbc3bcf82'
rpt2:     cache miss
rpt2: generated declarations for '/opt/atlassian/pipelines/agent/build/src/constants.ts'
....REDACTING....
�[1m�[31m[!] �[1m(plugin rpt2) Error: /opt/atlassian/pipelines/agent/build/src/components/ThemeProvider/ThemeProvider.tsx(110,46): semantic error TS2322: Type 'React.ReactNode' is not assignable to type 'import("/opt/atlassian/pipelines/agent/build/node_modules/@types/styled-components/node_modules/@types/react/index").ReactNode'.
  Type '{}' is not assignable to type 'ReactNode'.�[22m�[1m�[39m�[22m
src/components/ThemeProvider/ThemeProvider.tsx
�[2mError: /opt/atlassian/pipelines/agent/build/src/components/ThemeProvider/ThemeProvider.tsx(110,46): semantic error TS2322: Type 'React.ReactNode' is not assignable to type 'import("/opt/atlassian/pipelines/agent/build/node_modules/@types/styled-components/node_modules/@types/react/index").ReactNode'.
  Type '{}' is not assignable to type 'ReactNode'.
    at error (/opt/atlassian/pipelines/agent/build/node_modules/rollup/dist/shared/rollup.js:198:30)
    at throwPluginError (/opt/atlassian/pipelines/agent/build/node_modules/rollup/dist/shared/rollup.js:21847:12)
    at Object.error (/opt/atlassian/pipelines/agent/build/node_modules/rollup/dist/shared/rollup.js:22570:20)
    at Object.error (/opt/atlassian/pipelines/agent/build/node_modules/rollup/dist/shared/rollup.js:22024:42)
    at RollupContext.error (/opt/atlassian/pipelines/agent/build/node_modules/rollup-plugin-typescript2/src/rollupcontext.ts:37:18)
    at /opt/atlassian/pipelines/agent/build/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:41:11
    at arrayEach (/opt/atlassian/pipelines/agent/build/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:530:11)
    at Function._.each [as forEach] (/opt/atlassian/pipelines/agent/build/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:9410:14)
    at printDiagnostics (/opt/atlassian/pipelines/agent/build/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:9:2)
    at Object.transform (/opt/atlassian/pipelines/agent/build/node_modules/rollup-plugin-typescript2/src/index.ts:244:5)�[22m

Skipping cache upload for failed step
Searching for test report files in directories named [test-results, failsafe-reports, test-reports, TestResults, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.

@agilgur5 agilgur5 changed the title semantic error TS2322: Type 'React.ReactNode' is not assignable to type 'import("/opt/atlassian/pipelines/agent/build/node_modules/@types/styled-components/node_modules/@types/react/index").ReactNode' semantic error TS2322: Type 'React.ReactNode' is not assignable to type 'import("/opt/atlassian/pipelines/agent/build/node_modules/@types/styled-components/node_modules/@types/react/index").ReactNode' Apr 23, 2022
@agilgur5 agilgur5 changed the title semantic error TS2322: Type 'React.ReactNode' is not assignable to type 'import("/opt/atlassian/pipelines/agent/build/node_modules/@types/styled-components/node_modules/@types/react/index").ReactNode' Cache error with Bitbucket Pipelines (works locally) Apr 23, 2022
@agilgur5
Copy link
Collaborator

Difficult to tell, I'm not sure from a quick glance at the log (ezolenko might be able to interpret better)

It's very possible that you have a corrupted cache in your pipeline, and if you fix that once, it might start working from there on.

You can also use clean: true to configure rpt2 in your pipeline to use a fresh cache (this is for rpt2's own cache, not any other caches you may have)

@agilgur5 agilgur5 added the solution: workaround available There is a workaround available for this issue label Apr 24, 2022
@agilgur5 agilgur5 added the problem: stale Issue has not been responded to in some time label May 4, 2022
@agilgur5 agilgur5 changed the title Cache error with Bitbucket Pipelines (works locally) Type '{}' is not assignable to type 'ReactNode' with Bitbucket pipelines cache -- need to specify @types/react-dom May 10, 2022
@agilgur5 agilgur5 added the solution: tsc behavior This is tsc's behavior as well, so this is not a bug with this plugin label May 10, 2022
@agilgur5 agilgur5 changed the title Type '{}' is not assignable to type 'ReactNode' with Bitbucket pipelines cache -- need to specify @types/react-dom Type '{}' is not assignable to type 'ReactNode' with Bitbucket pipelines cache (works locally) -- need to specify @types/react-dom May 10, 2022
@agilgur5 agilgur5 added solution: out-of-scope This is out of scope for this project kind: support Asking for support with something or a specific use case labels May 10, 2022
@agilgur5
Copy link
Collaborator

agilgur5 commented May 10, 2022

I looked this up and it seems like this a typing / dependency error.
This SO question is very similar, saying it works locally but fails on Vercel.
That duplicated this SO question, where answers recommend either using Yarn resolutions / npm overrides or specifying a more granular version of @types/react-dom / @types/react in your devDeps.
It seems like you don't have @types/react-dom specified in your devDeps, hence hitting this issue depending on how your node_modules was resolved.

The corresponding React issue for this (which also lists workarounds and links out to other issues, such as in DefinitelyTyped) can be found here: facebook/react#24304

Given the timing of the SO questions, related issues, React 18's release, and the coincided timing of this issue, it seems highly likely that this is the same issue.

As such this is unrelated to this plugin and the behavior should be identical when using tsc as well. Due to this, as well as the fact that OP has not responded, closing out this issue.

@agilgur5 agilgur5 added the scope: integration Related to an integration, not necessarily to core (but could influence core) label May 10, 2022
@mgo-af
Copy link
Author

mgo-af commented May 10, 2022

Thank you! 🙏

@agilgur5 agilgur5 removed the problem: stale Issue has not been responded to in some time label May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: support Asking for support with something or a specific use case scope: integration Related to an integration, not necessarily to core (but could influence core) solution: out-of-scope This is out of scope for this project solution: tsc behavior This is tsc's behavior as well, so this is not a bug with this plugin solution: workaround available There is a workaround available for this issue
Projects
None yet
Development

No branches or pull requests

2 participants