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

Cannot import SelectItem in TypeScript #2983

Closed
bear-bibeault opened this issue Jun 9, 2022 · 7 comments · Fixed by #2984
Closed

Cannot import SelectItem in TypeScript #2983

bear-bibeault opened this issue Jun 9, 2022 · 7 comments · Fixed by #2984
Assignees
Labels
Component: Documentation Issue or pull request is related to Documentation Typescript Issue or pull request is *only* related to TypeScript definition
Milestone

Comments

@bear-bibeault
Copy link

bear-bibeault commented Jun 9, 2022

Describe the bug

Using 8.1.1

The Get Started states that you can import SelecItem via:

import { SelectItem } from 'primereact/api';

But TS complains: Module '"primereact/api"' has no exported member 'SelectItem'., and indeed, api.d.ts contains no such type.

Attempting to import directly via import { SelectItem } from "primereact/selectitem"; also fails with TS complaining:

File name '/Users/xyz/projects/aw-next/aw-ui-portal/node_modules/primereact/selectitem/selectitem.d.ts' differs from already included file name '/Users/xyz/projects/aw-next/aw-ui-portal/node_modules/primereact/selectitem/SelectItem.d.ts' only in casing.
  The file is in the program because:
    Imported via '../selectitem/SelectItem' from file '/Users/xyz/projects/aw-next/aw-ui-portal/node_modules/primereact/dropdown/dropdown.d.ts' with packageId 'primereact/selectitem/[email protected]'
    Imported via "primereact/selectitem" from file '/Users/xyz/projects/aw-next/aw-ui-portal/src/features/istrike/IStrikeServiceSelector.tsx'ts(1149)
dropdown.d.ts(5, 39): File is included via import here. 

However, SelectItem is not exported by dropdown.d.ts so it cannot be imported from there.

How does one go about importing SelectItem? I'd rather not resort to using any.

Reproducer

https://codesandbox.io/s/primereact-test-forked-vtvy4x?file=/src/index.tsx

PrimeReact version

8.1.1

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

Attempting to import SelectItem in various ways, including the manner shown in the Getting Started document, fails in various ways as noted in the report.

Expected behavior

Ability to import SelectItem as described in the Getting Started document.

@bear-bibeault bear-bibeault added Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a defect related to a specific component. labels Jun 9, 2022
@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 9, 2022
@melloware melloware self-assigned this Jun 9, 2022
@melloware melloware added this to the 8.2.0 milestone Jun 9, 2022
@melloware
Copy link
Member

Fixed already in master for 8.2.0 see this ticket: #2945

@melloware
Copy link
Member

Actually let me look at this

@melloware
Copy link
Member

This is the correct import...

import { SelectItem } from "primereact/selectitem";

@melloware melloware added the Component: Documentation Issue or pull request is related to Documentation label Jun 9, 2022
melloware added a commit to melloware/primereact that referenced this issue Jun 9, 2022
@melloware
Copy link
Member

What OS are you running on as well?

@melloware melloware added Typescript Issue or pull request is *only* related to TypeScript definition and removed Type: Bug Issue contains a defect related to a specific component. labels Jun 9, 2022
@bear-bibeault
Copy link
Author

macOS Mojave

@melloware
Copy link
Member

OK good I am pretty sure my fix for #2945 will fix your issue in 8.2.0

@bear-bibeault
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Documentation Issue or pull request is related to Documentation Typescript Issue or pull request is *only* related to TypeScript definition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants