Skip to content

Commit 1644abb

Browse files
authored
fix: check that root element exists in ts plugin template (#2385)
* fix: Use non-null assertion operator for `root` to pass type check * chore: Remove non-null assertion operator * chore: format code
1 parent db70fdc commit 1644abb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • plugins/dev-create/templates/typescript-plugin/template/test

plugins/dev-create/templates/typescript-plugin/template/test/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ document.addEventListener('DOMContentLoaded', function () {
3636
const defaultOptions = {
3737
toolbox: toolboxCategories,
3838
};
39-
createPlayground(
40-
document.getElementById('root'),
41-
createWorkspace,
42-
defaultOptions,
43-
);
39+
const rootElement = document.getElementById('root');
40+
if (!rootElement) {
41+
throw new Error(`div with id 'root' not found`);
42+
}
43+
createPlayground(rootElement, createWorkspace, defaultOptions);
4444
});

0 commit comments

Comments
 (0)