mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
fix(types): Fixes HTMLAttribute extend to allow everything (#10561)
* fix(types): Fixes HTMLAttribute extend to allow everything * nit: add types.d.ts file to the list of file to run astrocheck for * nit: do it some other way
This commit is contained in:
parent
303cacc058
commit
51a4ea5f72
3 changed files with 12 additions and 6 deletions
1
.github/workflows/check.yml
vendored
1
.github/workflows/check.yml
vendored
|
@ -13,6 +13,7 @@ on:
|
|||
- "scripts/smoke/check.js"
|
||||
- "packages/astro/src/@types/astro.ts"
|
||||
- "pnpm-lock.yaml"
|
||||
- "packages/astro/types.d.ts"
|
||||
|
||||
env:
|
||||
ASTRO_TELEMETRY_DISABLED: true
|
||||
|
|
8
packages/astro/astro-jsx.d.ts
vendored
8
packages/astro/astro-jsx.d.ts
vendored
|
@ -526,7 +526,7 @@ declare namespace astroHTML.JSX {
|
|||
| 'search'
|
||||
| 'send'
|
||||
| undefined
|
||||
| null;
|
||||
| null;
|
||||
exportparts?: string | undefined | null;
|
||||
hidden?: boolean | string | undefined | null;
|
||||
id?: string | undefined | null;
|
||||
|
@ -584,6 +584,9 @@ declare namespace astroHTML.JSX {
|
|||
results?: number | string | undefined | null;
|
||||
security?: string | undefined | null;
|
||||
unselectable?: 'on' | 'off' | undefined | null; // Internet Explorer
|
||||
|
||||
// Allow data- attribute
|
||||
[key: `data-${string}`]: any;
|
||||
}
|
||||
|
||||
type HTMLAttributeReferrerPolicy =
|
||||
|
@ -1344,6 +1347,9 @@ declare namespace astroHTML.JSX {
|
|||
yChannelSelector?: string | undefined | null;
|
||||
z?: number | string | undefined | null;
|
||||
zoomAndPan?: string | undefined | null;
|
||||
|
||||
// Allow data- attribute
|
||||
[key: `data-${string}`]: any;
|
||||
}
|
||||
|
||||
interface DefinedIntrinsicElements {
|
||||
|
|
9
packages/astro/types.d.ts
vendored
9
packages/astro/types.d.ts
vendored
|
@ -9,18 +9,17 @@ export type HTMLTag = keyof astroHTML.JSX.DefinedIntrinsicElements;
|
|||
export type HTMLAttributes<Tag extends HTMLTag> = Omit<
|
||||
astroHTML.JSX.IntrinsicElements[Tag],
|
||||
keyof Omit<AstroBuiltinAttributes, 'class:list'>
|
||||
> & {
|
||||
[key: string]: string | number | boolean | null | undefined;
|
||||
};
|
||||
>;
|
||||
|
||||
/**
|
||||
* All the CSS properties available, as defined by the CSS specification
|
||||
*/
|
||||
export type CSSProperty = keyof astroHTML.JSX.KebabCSSDOMProperties;
|
||||
|
||||
type PolymorphicAttributes<P extends { as: HTMLTag }> = Omit<P & HTMLAttributes<P['as']>, 'as'> & {
|
||||
type PolymorphicAttributes<P extends { as: HTMLTag }> = Omit<P, 'as'> & {
|
||||
as?: P['as'];
|
||||
};
|
||||
} & HTMLAttributes<P['as']>;
|
||||
|
||||
export type Polymorphic<P extends { as: HTMLTag }> = PolymorphicAttributes<
|
||||
Omit<P, 'as'> & { as: NonNullable<P['as']> }
|
||||
>;
|
||||
|
|
Loading…
Reference in a new issue