ionic-team / ionic-team/ionic-framework

bug: DatetimeChangeEventDetail value attribute has wrong type

Abierto
#30,377 0 comentarios 0 reacciones 0 asignados Ver en GitHub
needs: investigation
Lenguaje dominante
TypeScript
Estrellas
52.7k
Forks
13.3k
Merge medio
1 d 15 h
PR fusionados (30 d)
51

Descripción

### Prerequisites

- [x] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#creating-an-issue).
- [x] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [x] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v8.x

### Current Behavior

The value attribute now has type of:
```
value?: string | string[] | null;
```
in @ ionic\core\dist\types\components\datetime\datetime-interface.d.ts

This does not match the specification given here https://ionicframework.com/docs/api/datetime#datetimechangeeventdetail
```
interface DatetimeChangeEventDetail {
value?: string | null;
}
```

### Expected Behavior

Type should match online documentation.

### Steps to Reproduce

```
const handler = (event: CustomEvent & { target: HTMLIonDatetimeElement }) => {
new Date(event.detail?.value ?? 0)
}
```
gives typescript error: Type 'string[]' is not assignable to type 'string | number'

### Code Reproduction URL

none

### Ionic Info

Ionic:

Ionic CLI : 7.2.0 (C:\Users\[...user...]\AppData\Roaming\npm\node_modules\@ionic\cli)

Capacitor:

Capacitor CLI : 7.2.0
@capacitor/android : 7.2.0
@capacitor/core : 7.2.0
@capacitor/ios : 7.2.0

Utility:

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

System:

NodeJS : v22.12.0 (C:\Program Files\nodejs\node.exe)
npm : 11.3.0
OS : Windows 10

### Additional Information

_No response_

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start with @ionic/core/dist/types/components/datetime/datetime-interface.d.ts and compare DatetimeChangeEventDetail with the linked datetime API specification. Confirm where this declaration is maintained before changing it. Done means the event detail value type matches the documented string-or-null contract and the TypeScript reproduction no longer errors.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
frontend
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
52/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.