-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
I was trying to write some type definition for the styled-components project, but it looks like there is no way to specify a generic when using a tagged template. So... here is a subset of the typedef I'm writing:
declare module 'styled-components' {
import * as React from "react";
export function input<P>(values: TemplateStringsArray): React.StatelessComponent<P>;
}
This is how I'd like to use it:
import * as React from 'react';
/// <reference path="../../../typings/styled-components/styled-components.d.ts" />
import styled from 'styled-components';
interface Props {
placeholder: string;
}
const Input = styled.input<Props>`
font-size: 1.5em;
text-align: center;
color: palevioletred;
`;
I know that it can also be possible to override Input.propTypes manually[1], but I was wondering if this could be an useful addition to Typescript.
TypeScript Version: 2.0.3
[1] Or even write a custom component and just use the styled(Component)
style`` syntax
mxstbr, blakeembrey, Igorbek, victorandree, ErikCupal and 43 more
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript