microsoft / microsoft/TypeScript
Incorrect type handing/reduction
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔎 Search Terms
withTranslation, reduxForm, IntrinsicAttributes
🕗 Version & Regression Information
- This is the behavior in every version I tried (that supports this type checking), and I reviewed the FAQ for entries about
⏯ Playground Link
💻 Code
import React from 'react';
import { reduxForm, InjectedFormProps } from 'redux-form';
import { withTranslation, WithTranslation } from 'react-i18next';
type TProps = { p: number };
type TFormFields = { k?: number };
type TAllProps = TProps & WithTranslation;
type TT = TAllProps & InjectedFormProps<TFormFields, TAllProps>;
const G = (P: TT) => <img alt={String(P.p)} />;
const GFormed = reduxForm<TFormFields, TAllProps>({ form: 'f' })(G);
const GForm = withTranslation()(GFormed);
export const F = () => <GForm p={1} />;
🙁 Actual behavior
It complains about the last line, about p={1} -
Type '{ p: number; }' is not assignable to type 'IntrinsicAttributes & Omit<Subtract<DecoratedFormProps<TFormFields, TAllProps, string> | undefined, WithTranslationProps>, keyof WithTranslation<...>> & WithTranslationProps'.
Property 'p' does not exist on type 'IntrinsicAttributes & Omit<Subtract<DecoratedFormProps<TFormFields, TAllProps, string> | undefined, WithTranslationProps>, keyof WithTranslation<...>> & WithTranslationProps'.
It is wrong or non-sensical, as all of those types I used add or omit their high-order-component types from the type I pass, so ComponentType<TProps> should end up being the type of GForm, but it is not
🙂 Expected behavior
No type errors
Additional information about the issue
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la riproduzione collegata di TypeScript Playground e riduci l’interazione tra reduxForm, withTranslation, IntrinsicAttributes e le props del componente. Confronta il tipo inferito di GForm con l’errore segnalato, quindi verifica che l’utilizzo finale di JSX non produca errori di tipo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- react, typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100