Comparing version 3.3.0 to 3.3.1
@@ -0,1 +1,30 @@ | ||
## 3.3.1 (March 16, 2024) | ||
### Features | ||
- #### feat: added an option to extend the allowed attribute type on all tags all at once ([#330](https://github.com/ncpa0/jsxte/pull/330)) | ||
Added a new functionality that allows users to define a type that all attributes on all tags will accept. | ||
```ts | ||
class Box<T> { | ||
constructor(public v: T) {} | ||
toString() { | ||
return String(this.v); | ||
} | ||
} | ||
declare global { | ||
namespace JSXTE { | ||
interface AttributeAcceptedTypes { | ||
ALL: Box<any>; | ||
} | ||
} | ||
} | ||
// thanks to the interface declared above, the following will not raise errors: | ||
const div = <div class={new Box(123)}></div>; // ok | ||
``` | ||
## 3.3.0 (February 1, 2024) | ||
@@ -2,0 +31,0 @@ |
@@ -9,6 +9,9 @@ import type { ComponentApi } from "../component-api/component-api"; | ||
] extends [never] ? JSXTE.BaseHTMLTagProps : Partial<T> & JSXTE.BaseHTMLTagProps>>; | ||
type ExtendAllValues<T> = JSXTE.AttributeAcceptedTypes extends { | ||
ALL: infer U; | ||
} ? T | U : T; | ||
type ExtendBaseProps<P> = { | ||
[K in keyof P]: JSXTE.AttributeAcceptedTypes extends { | ||
[E in K]: infer T; | ||
} ? T | P[K] : P[K]; | ||
} ? ExtendAllValues<T | P[K]> : ExtendAllValues<P[K]>; | ||
}; | ||
@@ -15,0 +18,0 @@ declare global { |
{ | ||
"name": "jsxte", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "JSX-based html templating engine for browsers or Node environments.", | ||
@@ -55,4 +55,4 @@ "license": "MIT", | ||
"@types/node": "^20.10.6", | ||
"@typescript-eslint/eslint-plugin": "~6.19.1", | ||
"@typescript-eslint/parser": "~6.19.1", | ||
"@typescript-eslint/eslint-plugin": "~7.0.0", | ||
"@typescript-eslint/parser": "~6.21.0", | ||
"axios": "~1.6.0", | ||
@@ -59,0 +59,0 @@ "dprint": "^0.45.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
324147
8215