Add typescript for type checking

This commit is contained in:
John Lees-Miller 2020-04-28 20:38:34 +01:00
parent c46075aaab
commit 1a38f4e4ff
7 changed files with 24 additions and 9 deletions

View file

@ -17,9 +17,6 @@
"files": ["test/**/*.js"],
"env": {
"mocha": true
},
"globals": {
"expect": "readonly"
}
}
]

View file

@ -36,6 +36,12 @@
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
"dev": true
},
"@types/node": {
"version": "13.13.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.2.tgz",
"integrity": "sha512-LB2R1Oyhpg8gu4SON/mfforE525+Hi/M1ineICEDftqNVTyFg1aRIeGuTvXAoWHc4nbrFncWtJgMmoyRvuGh7A==",
"dev": true
},
"acorn": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
@ -2207,6 +2213,12 @@
"integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
"dev": true
},
"typescript": {
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
"dev": true
},
"uri-js": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",

View file

@ -5,12 +5,14 @@
"main": "index.js",
"scripts": {
"lint": "eslint .",
"test": "mocha --require test/support"
"test": "mocha",
"typecheck": "tsc --allowJs --checkJs --noEmit --moduleResolution node --target ES6 *.js test/**/*.js"
},
"author": "Overleaf (https://www.overleaf.com)",
"license": "MIT",
"repository": "github:overleaf/o-error",
"devDependencies": {
"@types/node": "^13.13.2",
"chai": "^3.3.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
@ -24,6 +26,7 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"mocha": "^7.1.1",
"prettier": "^2.0.2"
"prettier": "^2.0.2",
"typescript": "^3.8.3"
}
}

View file

@ -1,3 +1,5 @@
const { expect } = require('chai')
const HttpErrors = require('../http')
const { expectError } = require('./support')

View file

@ -1,4 +1,5 @@
const { getFullInfo, getFullStack, hasCauseInstanceOf } = require('..')
const { expect } = require('chai')
describe('OError.getFullInfo', function () {
it('works on a normal error', function () {

View file

@ -1,3 +1,5 @@
const { expect } = require('chai')
const OError = require('..')
const { expectError } = require('./support')

View file

@ -1,8 +1,6 @@
'use strict'
const { expect } = require('chai')
var chai = require('chai')
global.expect = chai.expect
const OError = require('../..')
exports.expectError = function OErrorExpectError(e, expected) {
// should set the name to the error's name