mirror of
https://github.com/google/blockly.git
synced 2026-01-07 09:00:11 +01:00
* fix: TS errors on dependent projects with certain tsconfig settings (#6360) * Address PR comments
This commit is contained in:
@@ -417,20 +417,18 @@ function addAttributes(node: Node, obj: AnyDuringMigration) {
|
||||
*/
|
||||
export function parseToolboxTree(toolboxDef: Element|null|string): Element|
|
||||
null {
|
||||
let parsedToolboxDef: Element|null = null;
|
||||
if (toolboxDef) {
|
||||
if (typeof toolboxDef !== 'string' && !(toolboxDef instanceof Element)) {
|
||||
toolboxDef = null;
|
||||
}
|
||||
if (typeof toolboxDef === 'string') {
|
||||
toolboxDef = Xml.textToDom(toolboxDef);
|
||||
if (toolboxDef.nodeName.toLowerCase() !== 'xml') {
|
||||
parsedToolboxDef = Xml.textToDom(toolboxDef);
|
||||
if (parsedToolboxDef.nodeName.toLowerCase() !== 'xml') {
|
||||
throw TypeError('Toolbox should be an <xml> document.');
|
||||
}
|
||||
} else if (toolboxDef instanceof Element) {
|
||||
parsedToolboxDef = toolboxDef;
|
||||
}
|
||||
} else {
|
||||
toolboxDef = null;
|
||||
}
|
||||
return toolboxDef;
|
||||
return parsedToolboxDef;
|
||||
}
|
||||
|
||||
export const TEST_ONLY = {
|
||||
|
||||
Reference in New Issue
Block a user