-
Notifications
You must be signed in to change notification settings - Fork 265
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
Add id to TS file #326
Add id to TS file #326
Conversation
Thanks @rodlukas. That will definitely do it but is that just delaying another issue with a different property? My question is what does this component need to extend to include this automatically? For example this line in the type definitions mentions the Should the interface be changed to include export interface FontAwesomeIconProps extends BackwardCompatibleOmit<DOMAttributes<SVGSVGElement>, 'children' | 'mask'> { |
@robmadole Yeah, this commit only solves the The interface can be IMO changed without any conflicts to export interface FontAwesomeIconProps extends BackwardCompatibleOmit<HTMLAttributes<SVGSVGElement>, 'children' | 'mask'> { OR in the file there's also export interface FontAwesomeIconProps extends BackwardCompatibleOmit<SVGAttributes<SVGSVGElement>, 'children' | 'mask' | 'transform'> { |
Thank you @rodlukas ! I think this one is the winner: export interface FontAwesomeIconProps extends BackwardCompatibleOmit<SVGAttributes<SVGSVGElement>, 'children' | 'mask' | 'transform'> { Is there a way where you could give that a quick smoke-test locally and make sure it doesn't immediately cause issues? |
@robmadole Successfully tested on my local larger codebase, everything works, TS compiler is OK, ESLint is OK even with Here's the index.d.ts code I tested (note the import section must be also updated) /// <reference types="react" />
import { CSSProperties, SVGAttributes } from 'react'
import {
Transform,
IconProp,
FlipProp,
SizeProp,
PullProp,
RotateProp,
FaSymbol
} from '@fortawesome/fontawesome-svg-core'
export function FontAwesomeIcon(props: FontAwesomeIconProps): JSX.Element
/**
* @deprecated use FontAwesomeIconProps
*/
export type Props = FontAwesomeIconProps
// This is identical to the version of Omit in Typescript 3.5. It is included for compatibility with older versions of Typescript.
type BackwardCompatibleOmit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
export interface FontAwesomeIconProps extends BackwardCompatibleOmit<SVGAttributes<SVGSVGElement>, 'children' | 'mask' | 'transform'> {
icon: IconProp
mask?: IconProp
className?: string
color?: string
spin?: boolean
pulse?: boolean
border?: boolean
fixedWidth?: boolean
inverse?: boolean
listItem?: boolean
flip?: FlipProp
size?: SizeProp
pull?: PullProp
rotation?: RotateProp
transform?: string | Transform
symbol?: FaSymbol
style?: CSSProperties
tabIndex?: number;
title?: string;
swapOpacity?: boolean;
} |
I'm happy enough with your result to go ahead and publish it. If we have issues we can do another release. @rodlukas are you willing to update this PR with your tested changes? |
corresponding issue: #324