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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Typescript] Select doesn't accept notched prop (missing extending OutlinedInputProps) #31208

Closed
2 tasks done
jrozbicki opened this issue Feb 25, 2022 · 0 comments 路 Fixed by #31209
Closed
2 tasks done
Labels
component: select This is the name of the generic UI component, not the React module! typescript

Comments

@jrozbicki
Copy link
Contributor

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 馃槸

Typescript throws error when trying to pass noched option to Select component as props.

Functionality works, just typescript is throwing errors.

Expected behavior 馃

Typescript not to throw error and accept inherited OutlinedInput props as stated in docs and Select.d.ts:

...
 * API:
 *
 * - [Select API](https://mui.com/api/select/)
 * - inherits [OutlinedInput API](https://mui.com/api/outlined-input/)
 */
declare const Select: (<T>(props: SelectProps<T>) => JSX.Element) & {
  muiName: string;
};

Steps to reproduce 馃暪

Steps:

  1. Visit forked version of Basic Select demo
  2. At line 22 typescript throws error Property 'notched' does not exist on type 'IntrinsicAttributes & SelectProps<string>'

Context 馃敠

I was trying to create Select with InputLabel. Label is interfering with displayEmpty and renderValue for value: "". This could be a candidate for another issue.

image

I found out that you can add shrink: true to InputLabel and notched to Select to keep label always on top.

Your environment 馃寧

npx @mui/envinfo
System:
    OS: macOS 12.0.1
  Binaries:
    Node: 14.17.1 - ~/.nvm/versions/node/v14.17.1/bin/node
    Yarn: 1.22.15 - ~/.yarn/bin/yarn
    npm: 6.14.13 - ~/.nvm/versions/node/v14.17.1/bin/npm
  Browsers:
    Chrome: 98.0.4758.109
    Edge: Not Found
    Firefox: 97.0.1
    Safari: 15.1
  npmPackages:
    @emotion/react: ^11.7.1 => 11.7.1 
    @emotion/styled: ^11.6.0 => 11.6.0 
    @mui/base:  5.0.0-alpha.69 
    @mui/icons-material: ^5.2.5 => 5.2.5 
    @mui/lab: ^5.0.0-alpha.69 => 5.0.0-alpha.69 
    @mui/material: ^5.4.3 => 5.4.3 
    @mui/private-theming:  5.2.3 
    @mui/styled-engine:  5.4.2 
    @mui/styles:  5.2.3 
    @mui/system:  5.4.3 
    @mui/types:  7.1.0 
    @mui/utils:  5.2.3 
    @types/react: ^17.0.38 => 17.0.38 
    react: ^17.0.2 => 17.0.2 
    react-dom: ^16.12.0 => 16.12.0 
    typescript: 4.1.6 => 4.1.6
tsconfig.json
{
  "compilerOptions": {
    "types": ["@emotion/core", "node", "jest", "@testing-library/jest-dom"],
    "baseUrl": "src",
    "target": "es5",
    "jsx": "react-jsx",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitThis": true,
    "strictNullChecks": true
  },
  "include": ["src", "emotion.d.ts"]
}
@jrozbicki jrozbicki added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 25, 2022
@jrozbicki jrozbicki changed the title [Typescript] Select is not extending OutlinedInputProps [Typescript] Select doesn't accept notched prop (missing extending OutlinedInputProps) Feb 25, 2022
@danilo-leal danilo-leal added component: select This is the name of the generic UI component, not the React module! typescript and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants