Skip to content

Commit

Permalink
fix: change the identifier of the bezier icon to a string literal ins…
Browse files Browse the repository at this point in the history
…tead of a symbol (#1411)

* fix: change the identifier of the bezier icon to a string literal instead of a symbol

* chore(changeset): add changeset
  • Loading branch information
sungik-choi committed Jun 9, 2023
1 parent 30fb818 commit 0e6af01
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-pumas-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@channel.io/bezier-icons": minor
---

Change the identifier of the bezier icon to a string literal instead of a symbol
2 changes: 1 addition & 1 deletion packages/bezier-icons/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ declare module '*.svg' {
}
export declare type IconSource = React.FunctionComponent<React.SVGProps<SVGSVGElement>>
export declare type BezierIcon = IconSource & { __type: 'BezierIcon' }
export declare type BezierIcon = IconSource & { __bezier__icon: true }
export declare function isBezierIcon(arg: unknown): arg is BezierIcon
export declare function createBezierIcon(icon: IconSource): BezierIcon
Expand Down
6 changes: 3 additions & 3 deletions packages/bezier-icons/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
* so set the type inside this module to 'any'.
*/

const BEZIER_ICON_SYMBOL = Symbol('bezier.icon')
const BEZIER_ICON_ID = '__bezier__icon'

export function isBezierIcon(arg: any) {
return (
typeof arg === 'function' &&
arg[BEZIER_ICON_SYMBOL] === true
arg[BEZIER_ICON_ID] === true
)
}

export function createBezierIcon(source: any) {
const clone = source
clone[BEZIER_ICON_SYMBOL] = true
clone[BEZIER_ICON_ID] = true
return clone
}

0 comments on commit 0e6af01

Please sign in to comment.