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

TS1109: Expression expected in Box.d.ts #35860

Closed
2 tasks done
tobiaswaltl opened this issue Jan 18, 2023 · 4 comments · Fixed by #35877
Closed
2 tasks done

TS1109: Expression expected in Box.d.ts #35860

tobiaswaltl opened this issue Jan 18, 2023 · 4 comments · Fixed by #35877
Assignees
Labels
bug 🐛 Something doesn't work component: Box The React component. regression A bug, but worse typescript

Comments

@tobiaswaltl
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Steps:

  1. Run tsc for an application that uses v5.11.5

Current behavior 😯

3 TS errors in node_modules/@mui/material/Box/Box.d.ts:15:

node_modules/@mui/material/Box/Box.d.ts:15:47 - error TS1005: '>' expected.

15 declare const Box: ReturnType<typeof createBox<MaterialTheme>>;
                                                 ~

node_modules/@mui/material/Box/Box.d.ts:15:62 - error TS1109: Expression expected.

15 declare const Box: ReturnType<typeof createBox<MaterialTheme>>;
                                                                ~

node_modules/@mui/material/Box/Box.d.ts:15:63 - error TS1109: Expression expected.

15 declare const Box: ReturnType<typeof createBox<MaterialTheme>>;

Expected behavior 🤔

tsc should complete without errors

Context 🔦

Probably introduced with https://github.com/mui/material-ui/pull/35532/files#diff-427bcf01d3498e79c0ef95d5426b7bdfc0694f490da7ba41cd44f9957c73ead7 where the ReturnType of a generic function is used.

Your environment 🌎

npx @mui/envinfo
 System:
    OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
  Binaries:
    Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node
    Yarn: 3.3.1 - ~/.nvm/versions/node/v16.18.1/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @emotion/react:  11.10.5
    @emotion/styled:  11.10.5
    @mui/base:  5.0.0-alpha.114
    @mui/core-downloads-tracker:  5.11.5
    @mui/icons-material:  5.11.0
    @mui/lab:  5.0.0-alpha.116
    @mui/material:  5.11.5
    @mui/private-theming:  5.11.2
    @mui/styled-engine:  5.11.0
    @mui/styles:  5.11.2
    @mui/system:  5.11.5
    @mui/types:  7.2.3
    @mui/utils:  5.11.2
    @types/react: ^17.0.44 => 17.0.52
    react: ^17.0.2 => 17.0.2
    react-dom: ^17.0.2 => 17.0.2
    typescript: ~4.6.4 => 4.6.4

tsconfig:

{
  "compilerOptions": {
    "noEmit": true,
    "allowJs": true,
    "target": "esnext",
    "lib": ["es6", "dom", "esnext"],
    "module": "esnext",
    "moduleResolution": "node",
    "strict": true,
    "pretty": true,
    "skipLibCheck": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "jsx": "react-jsx",
    "noUnusedLocals": true,
    "resolveJsonModule": true,
    "useUnknownInCatchVariables": false,
    "paths": {
      "@mobilexag/webdispo-core": ["./core/src"],
      "@mobilexag/webdispo-test-util": ["./test-util/src"],
      "test-util": ["./core/test-util"],
      "test-util/*": ["./core/test-util/*"],
      "@mobilex/dispatchx-test-and-story-util": ["./test-and-story-util/src"],
      // find type declarations
      "*": ["./@types/*"],
    }
  },
  "include": [
    "**/*",
    // Normally this isn't required and is already covered by "**/*",
    // but IntelliJ seems to need it or opening .eslintrc.js-Files are decorated
    // with an annoying error message about "parserOptions.project has been set"
    "**/.eslintrc.js"
  ],
  "exclude": [
    "node_modules",
    "**/coverage/*",
    "www/**/*",
    "public/**/*",
    "docker/frontend/www/**/*",
    "core/static"
  ]
}

@tobiaswaltl tobiaswaltl added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 18, 2023
@zannager zannager added typescript component: Box The React component. labels Jan 18, 2023
@tobiaswaltl
Copy link
Author

It seems that the aforementioned commit uses Instantiation Expressions which is a TS 4.7 feature. According to the MUI Guide, the minimal supported TS version is 3.5

After upgrading to ts@4.7.4 the error disappears.

@achyuth4t
Copy link

Hi @tobiaswaltl
I've tried with TS version 4.7.4 (previously it's 4.5.2) in my local application.

node_modules/@mui/material/Box/Box.d.ts:15:47 - error TS1005: '>' expected.

Error is disappeared.

@mnajdova mnajdova assigned mnajdova and unassigned siriwatknp Jan 18, 2023
@mnajdova
Copy link
Member

Thanks for the report and pin-pointing the issue. Would you like to create a PR for it? We can use directly the OverridableComponent type there, instead of the ReturnType generic.

@mnajdova
Copy link
Member

It was fixed in #35877 it will be available in the next release.

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work regression A bug, but worse and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: Box The React component. regression A bug, but worse typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants