type-fest
type-fest copied to clipboard
PartialDeep should skip HTMLCanvasElement
import type { PartialDeep } from 'type-fest';
export interface TextElement {
canvas: HTMLCanvasElement;
}
const a: PartialDeep<TextElement> = {} as TextElement;
versions:
ts: 5.1.6
type-fest: 4.0
Upvote & Fund
- We're using Polar.sh so you can upvote and help fund this issue.
- The funding will be given to active contributors.
- Thank you in advance for helping prioritize & fund our backlog.
help ~ how solve the question?
@sindresorhus
Anther way, maybe we should not skip HTMLCanvasElement
?
PartialDeep<{a: HTMLCanvasElement}>['a']
is equal to Partial<HTMLCanvasElement>
, look like is a normal behavior.
If need, we can add option to specify the non-recursive or impartible type to be skiped in deep-type.
No one would actually do Partial<HTMLCanvasElement>
though. I would rather PartialDeep
work like people expect and not recurse into built-in types.
No one would actually do
Partial<HTMLCanvasElement>
though. I would ratherPartialDeep
work like people expect and not recurse into built-in types.
Is it ok?
export type BuiltIns = Primitive | Date | RegExp
changed to
export type BuiltInClass /** or other name */ = Date | RegExp | Element ... and more
export type BuiltIns = Primitive | BuiltInClass
or just BuiltIns = Primitive | Date | RegExp | Element
Reopening as it was reverted in https://github.com/sindresorhus/type-fest/releases/tag/v4.8.1