@@ -17,16 +17,16 @@ export type SetTextContent = {
1717} ;
1818
1919/** Record from attribute names to attribute values */
20- export type Attributes = Partial < Record < string , string | null > > ;
20+ export type AttributesV2 = Partial < Record < string , string | null > > ;
2121
2222/** Record from namespace URIs to `Attributes` records */
23- export type AttributesNS = Partial < Record < string , Attributes > > ;
23+ export type AttributesNS = Partial < Record < string , AttributesV2 > > ;
2424
2525/** Intent to set or remove (if `null`) `attributes`(-`NS`) on `element` */
2626export type SetAttributes = {
2727 element : Element ;
28- attributes : Attributes ;
29- attributesNS : AttributesNS ;
28+ attributes ?: AttributesV2 ;
29+ attributesNS ? : AttributesNS ;
3030} ;
3131
3232/** Intent to change some XMLDocuments */
@@ -37,7 +37,9 @@ export type EditV2 =
3737 | Remove
3838 | EditV2 [ ] ;
3939
40- export function isAttributes ( attributes : unknown ) : attributes is Attributes {
40+ export function isAttributesV2 (
41+ attributes : unknown ,
42+ ) : attributes is AttributesV2 {
4143 if ( typeof attributes !== 'object' || attributes === null ) {
4244 return false ;
4345 }
@@ -56,7 +58,7 @@ export function isAttributesNS(
5658 return Object . entries ( attributesNS ) . every (
5759 ( [ namespace , attributes ] ) =>
5860 typeof namespace === 'string' &&
59- isAttributes ( attributes as Record < string , string | null > ) ,
61+ isAttributesV2 ( attributes as Record < string , string | null > ) ,
6062 ) ;
6163}
6264
@@ -81,7 +83,7 @@ export function isRemove(edit: unknown): edit is Remove {
8183export function isSetAttributes ( edit : unknown ) : edit is SetAttributes {
8284 return (
8385 ( edit as SetAttributes ) . element instanceof Element &&
84- isAttributes ( ( edit as SetAttributes ) . attributes ) &&
86+ isAttributesV2 ( ( edit as SetAttributes ) . attributes ) &&
8587 isAttributesNS ( ( edit as SetAttributes ) . attributesNS )
8688 ) ;
8789}
0 commit comments