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

bug: placeholder types not compliant in ionic / react #22976

Closed
HagenMorano opened this issue Feb 26, 2021 · 2 comments · Fixed by #23500
Closed

bug: placeholder types not compliant in ionic / react #22976

HagenMorano opened this issue Feb 26, 2021 · 2 comments · Fixed by #23500
Assignees
Labels
package: core @ionic/core package type: bug a confirmed bug report
Milestone

Comments

@HagenMorano
Copy link

Bug Report

Ionic version:
see below

Typescript version:
"typescript": "^4.1.3",

Current behavior:
When trying to apply properties of type JSX.IonInput to an <IonInput />, there is a type error (Types of property 'placeholder' are incompatible.)

Expected behavior:
There should be no error.

Steps to reproduce:

  1. Create new variable of type JSX.IonInput
    const props: JSX.IonInput = { };
  2. Create new Element and apply props:
    <IonInput {...props} />

Related code:

import { JSX } from '@ionic/core/dist/types/components';
import { IonInput } from '@ionic/react';
import React from 'react';

const ExploreContainer: React.FC = () => {
  const props: JSX.IonInput = {};
  return (
    <IonInput {...props} />
  );
};

Other information:
Identified problem:
placeholder in interface HTMLAttributes located in node_modules/@types/react/index.d.ts is not compliant with placeholder in namespace LocalJSX interface IonInput located in node_modules/@ionic/core/dist/types/components.d.ts

(one is undefined | string other is undefined | string | null)

Workaround:
const props: Omit<JSX.IonInput, 'placeholder'> = { };

Ionic info:

Ionic:

   Ionic CLI       : 6.9.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 5.5.4

Capacitor:

   Capacitor CLI   : 2.4.6
   @capacitor/core : 2.4.6

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v14.15.3 (/usr/local/bin/node)
   npm    : 6.14.9
   OS     : Linux 5.4

Additional question:
Is there a specific reason why placeholder is nullable?

@ionitron-bot ionitron-bot bot added the triage label Feb 26, 2021
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Mar 1, 2021
@liamdebeasi liamdebeasi added this to the 6.0.0 milestone Mar 1, 2021
@ionitron-bot ionitron-bot bot removed triage labels Mar 1, 2021
@willmartian willmartian self-assigned this Jun 17, 2021
willmartian added a commit that referenced this issue Jun 24, 2021
…ng only (#23500)

resolves #22976

BREAKING CHANGE: Updated the `placeholder` property on `ion-input`, `ion-textarea`, and `ion-select` to have a type of `string | undefined`.
@willmartian
Copy link
Contributor

Thank you for this issue! A fix for this will be available in Framework v6.

@ionitron-bot
Copy link

ionitron-bot bot commented Jul 24, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jul 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
3 participants