Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Type checks on as prop are not working properly聽#1527

Description

Bug Report

Type checks on as prop works only in basic case.

Primitive element

const a = <div type="button" />
// TS handles it 馃憤 
// Error:(9, 12) TS2322: Type '{ type: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.
//  Property 'type' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.

Stardust element

<Image type="button" />
// Works in this case, when `as` prop is not specified 馃憤 
// Error:(9, 12) TS2322: Type '{ type: string; }' is not assignable to type 'IntrinsicAttributes & Extended<ImageProps, DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>'.
//  Property 'type' does not exist on type 'IntrinsicAttributes & Extended<ImageProps, DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>'.

Stardust element and broken cases

<Image as='div' type="button" />
// still not assignable, but passes type checks 馃挘 
<Header description={{ as: 'div', type: 'button' }} />
// still not assignable, but passes type checks 馃挘 

Version

latest

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vstsPaired with ticket in vsts

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions