diff --git a/jsconfig.json b/jsconfig.json
index 192df60..c802454 100644
--- a/jsconfig.json
+++ b/jsconfig.json
@@ -1,4 +1,4 @@
{
"exclude": ["node_modules"],
- "include": ["src", "test", "typings"]
+ "include": ["src", "typings"]
}
diff --git a/package.json b/package.json
index e820266..59f6a59 100644
--- a/package.json
+++ b/package.json
@@ -23,10 +23,11 @@
"eslint-check": "eslint app.js src/**/*.js vite.config.ts test/**/*.ts",
"eslint-fix": "eslint app.js src/**/*.js vite.config.ts test/**/*.ts --fix",
"prettier-fix": "prettier --write .",
- "test": "vitest run --coverage && npm run prettier-fix && npm run eslint-fix && node update-readme-with-shield-badge.js",
+ "test": "vitest run --coverage && npm run prettier-fix && npm run eslint-fix && tsc && node update-readme-with-shield-badge.js",
"test:watch": "vitest",
"build-docs": "rimraf docs && ./node_modules/.bin/jsdoc -c jsdoc.config.js",
- "develop": "DEBUG=api,transformer,markdown,language node app.js & http-server test/forms -p 8081"
+ "develop": "DEBUG=api,transformer,markdown,language node app.js & http-server test/forms -p 8081",
+ "tsc": "tsc"
},
"repository": {
"type": "git",
diff --git a/test/bad-external.spec.ts b/test/bad-external.spec.ts
index 0973e4e..e249609 100644
--- a/test/bad-external.spec.ts
+++ b/test/bad-external.spec.ts
@@ -1,10 +1,9 @@
import { NAMESPACES } from '../src/transformer';
import {
- Document,
+ DocumentConstructor as Document,
getTransformedForm,
getTransformedModelDocument,
parser,
- XMLDocument,
} from './shared';
import type {
@@ -129,7 +128,7 @@ describe('for incompatible forms that require preprocessing', () => {
it('preprocess fn does nothing if not provided...', async () => {
const doc = await getTransformedModelDocument('bad-external.xml');
- expect(doc).to.be.an.instanceOf(XMLDocument);
+ expect(doc).to.be.an.instanceOf(Document);
expect(doc.getElementsByTagName('instance')).to.have.length(2);
expect(doc.getElementById('existing')).to.not.be.null;
expect(doc.getElementById('existing')!.getAttribute('src')).to.equal(
@@ -145,7 +144,7 @@ describe('for incompatible forms that require preprocessing', () => {
'text/xml'
);
- expect(preprocessedModel).to.be.an.instanceOf(XMLDocument);
+ expect(preprocessedModel).to.be.an.instanceOf(Document);
expect(
preprocessedModel.getElementsByTagName('instance')
).to.have.length(4);
diff --git a/test/shared.ts b/test/shared.ts
index 41668b2..f22721d 100644
--- a/test/shared.ts
+++ b/test/shared.ts
@@ -81,15 +81,14 @@ export const getTransformedModelDocument = async (
};
/**
- * TODO: `@xmldom/xmldom` does not export `Document`. It's pretty linkely that @see {@link https://github.com/WebReflection/linkedom | `linkedom`}:
+ * TODO: `@xmldom/xmldom` does not export `Document`. It's pretty linkely that {@link https://github.com/WebReflection/linkedom linkedom}:
*
* 1. Does export it.
* 2. Is a drop-in replacement for `@xmldom/xmldom`.
* 3. Could very possibly go away soon anyway ;)
*/
-export const Document = parser.parseFromString('', 'text/html').constructor;
+const document = parser.parseFromString('', 'text/html');
-/**
- * TODO: this is at least temporarily a necessary fib.
- */
-export const XMLDocument = Document;
+export const DocumentConstructor = document.constructor;
+
+export type Document = typeof document;
diff --git a/test/tsconfig.json b/test/tsconfig.json
deleted file mode 100644
index d0791da..0000000
--- a/test/tsconfig.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "../tsconfig.json",
- "files": ["../typings/test.d.ts"]
-}
diff --git a/tsconfig.base.json b/tsconfig.base.json
new file mode 100644
index 0000000..0151e33
--- /dev/null
+++ b/tsconfig.base.json
@@ -0,0 +1,29 @@
+{
+ "compilerOptions": {
+ "allowJs": true,
+ "allowSyntheticDefaultImports": true,
+ "allowUnreachableCode": false,
+ "baseUrl": ".",
+ "checkJs": false,
+ "declaration": false,
+ "downlevelIteration": true,
+ "esModuleInterop": true,
+ "experimentalDecorators": true,
+ "forceConsistentCasingInFileNames": true,
+ "inlineSourceMap": true,
+ "lib": ["ES2018"],
+ "module": "amd",
+ "moduleResolution": "node",
+ "noEmit": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "resolveJsonModule": true,
+ "skipLibCheck": true,
+ "strict": true,
+ "target": "es2018",
+ "types": ["node"]
+ },
+ "exclude": ["node_modules", "typings/test.d.ts"],
+ "include": ["src", "typings"]
+}
diff --git a/tsconfig.json b/tsconfig.json
index a78b4ab..95ac83f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,29 +1,5 @@
{
- "compilerOptions": {
- "allowJs": true,
- "allowSyntheticDefaultImports": true,
- "allowUnreachableCode": false,
- "baseUrl": ".",
- "checkJs": false,
- "declaration": false,
- "downlevelIteration": true,
- "esModuleInterop": true,
- "experimentalDecorators": true,
- "forceConsistentCasingInFileNames": true,
- "inlineSourceMap": true,
- "lib": ["ES2018"],
- "module": "amd",
- "moduleResolution": "node",
- "noEmit": true,
- "noFallthroughCasesInSwitch": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "resolveJsonModule": true,
- "skipLibCheck": true,
- "strict": true,
- "target": "es2018",
- "types": ["node"]
- },
- "exclude": ["node_modules", "typings/test.d.ts"],
- "include": ["src", "test", "typings"]
+ "extends": "./tsconfig.base.json",
+ "include": ["test", "typings"],
+ "files": ["./typings/test.d.ts"]
}