Skip to content

Commit b4dec78

Browse files
authored
Merge pull request #1075 from reduckted/feature/verify-typescript
test: verify various typescript configurations
2 parents e9035b1 + 7997e6b commit b4dec78

File tree

23 files changed

+216
-1
lines changed

23 files changed

+216
-1
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ jobs:
4343
TEST_PROBE_ONLY: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/2.x' }}
4444
BS_USERNAME: ${{ secrets.BS_USERNAME }}
4545
BS_ACCESSKEY: ${{ secrets.BS_ACCESSKEY }}
46+
- name: Verify TypeScript
47+
run: npm run verify-typescript

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"test:jsdom": "cross-env NODE_ENV=test BABEL_ENV=rollup node test/jsdom-node-runner --dot",
2020
"test:karma": "cross-env NODE_ENV=test BABEL_ENV=rollup karma start test/karma.conf.js --log-level warn ",
2121
"test:ci": "cross-env NODE_ENV=test BABEL_ENV=rollup npm run test:jsdom && npm run test:karma -- --log-level error --reporters dots --single-run --shouldTestOnBrowserStack=\"${TEST_BROWSERSTACK}\" --shouldProbeOnly=\"${TEST_PROBE_ONLY}\"",
22-
"test": "cross-env NODE_ENV=test BABEL_ENV=rollup npm run lint && npm run test:jsdom && npm run test:karma -- --browsers Chrome"
22+
"test": "cross-env NODE_ENV=test BABEL_ENV=rollup npm run lint && npm run test:jsdom && npm run test:karma -- --browsers Chrome",
23+
"verify-typescript": "node ./typescript/verify.js"
2324
},
2425
"main": "./dist/purify.cjs.js",
2526
"module": "./dist/purify.es.mjs",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as dompurify from 'dompurify';
2+
3+
dompurify.sanitize('<p>');
4+
dompurify().sanitize('<p>');
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"module": "CommonJS",
4+
"target": "ES2015",
5+
"typeRoots": ["types"]
6+
}
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This simulates not having `@types/trusted-types` installed.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as dompurify from 'dompurify';
2+
3+
dompurify.sanitize('<p>');
4+
dompurify().sanitize('<p>');
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"module": "CommonJS",
4+
"target": "ES2015",
5+
"types": ["node"]
6+
}
7+
}

typescript/commonjs/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as dompurify from 'dompurify';
2+
3+
dompurify.sanitize('<p>');
4+
dompurify().sanitize('<p>');

typescript/commonjs/tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"compilerOptions": {
3+
"module": "CommonJS",
4+
"target": "ES2015"
5+
}
6+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import dompurify from 'dompurify';
2+
3+
dompurify.sanitize('<p>');
4+
dompurify().sanitize('<p>');

0 commit comments

Comments
 (0)