element-internals-polyfill
element-internals-polyfill copied to clipboard
Missing aria properties
Receiving the following typescript error in my Angular app:
Error: node_modules/.pnpm/[email protected]/node_modules/element-internals-polyfill/dist/element-internals.d.ts:4:22 - error TS2420: Class 'ElementInternals' incorrectly implements interface 'IElementInternals'.
Type 'ElementInternals' is missing the following properties from type 'IElementInternals': ariaBrailleLabel, ariaBrailleRoleDescription
4 export declare class ElementInternals implements IElementInternals {
~~~~~~~~~~~~~~~~
Downgrading Typescript from 5.5.4 to 5.4.5 fixed the issue for now
I have a version of this in progress on the fix-ts branch if you want to look at it to see if it fixes your issues. I'm working through how best to test this right now.
Same issue here. In the meantime, there are two open PRs #134 and #135. Any chance this issue can be resolved?
Those PRs don’t actually fix the issue. If I could get feedback on the branch from the previous post I’ll merge and release that bi just don’t want to break anything else.
Any update on this? I'm using a dependency that requires TypeScript 5.5 or higher, so downgrading to a lower version to work around this issue is not an option. If I understand correctly, a branch with a fix exists, but it still needs an approved PR in order to be merged and released? Would be nice to have this soon.
I've published a prerelease of 2.x at version 2.0.0-next.1. LMK if that fixes your issue.
The error Type 'ElementInternals' is missing the following properties… isn't thrown anymore, but with typescript set to ^5.5.4 in package.json of my project I now get this error:
✘ [ERROR] TS2717: Subsequent property declarations must have the same type. Property 'form' must be of type 'HTMLFormElement | null', but here has type 'HTMLFormElement'. [plugin angular-compiler]
node_modules/element-internals-polyfill/dist/types.d.ts:18:17:
18 │ readonly form: HTMLFormElement;
╵ ~~~~
'form' was also declared here.
node_modules/typescript/lib/lib.dom.d.ts:8002:13:
8002 │ readonly form: HTMLFormElement | null;
╵ ~~~~
Seems that the types are not aligned, yours is missing | null. When I add that manually to element-internals-polyfill/dist/types.d.ts in the node_modules folder, the error is fixed and the build goes fine.
@Senne OK, I updated the next build to version 2.0.0-next.2 which has that fix in there as well. Thanks for finding that.
Thanks for publishing that newer version, Caleb. I now get these errors with TypeScript 5.5.4 however:
✘ [ERROR] TS2717: Subsequent property declarations must have the same type. Property 'ariaColIndexText' must be of type 'string | null', but here has type 'string'. [plugin angular-compiler]
node_modules/element-internals-polyfill/dist/types.d.ts:10:8:
10 │ ariaColIndexText: string;
╵ ~~~~~~~~~~~~~~~~
'ariaColIndexText' was also declared here.
node_modules/typescript/lib/lib.dom.d.ts:2421:4:
2421 │ ariaColIndexText: string | null;
╵ ~~~~~~~~~~~~~~~~
✘ [ERROR] TS2717: Subsequent property declarations must have the same type. Property 'ariaRowIndexText' must be of type 'string | null', but here has type 'string'. [plugin angular-compiler]
node_modules/element-internals-polyfill/dist/types.d.ts:14:8:
14 │ ariaRowIndexText: string;
╵ ~~~~~~~~~~~~~~~~
'ariaRowIndexText' was also declared here.
node_modules/typescript/lib/lib.dom.d.ts:2470:4:
2470 │ ariaRowIndexText: string | null;
╵ ~~~~~~~~~~~~~~~~
@Senne Oof, that's not throwing for me locally, but I've updated the implementation at 2.0.0-next.3
That indeed fixes the issue. Thank you for the quick responses!