Skip to content

Commit 89d55a9

Browse files
fix: typescript declarations (#84)
1 parent 6c6973b commit 89d55a9

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

declarations/validate.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ declare function validate(
3636
configuration?: ValidationErrorConfiguration | undefined
3737
): void;
3838
declare namespace validate {
39-
export { _default as ValidationError, _default as ValidateError };
39+
export { ValidationError };
40+
export { ValidationError as ValidateError };
4041
}
4142
import Ajv from 'ajv';
43+
import ValidationError from './ValidationError';

src/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
const validate = require('./validate');
2-
const ValidationError = require('./ValidationError');
32

43
module.exports = validate.default;
5-
module.exports.ValidationError = ValidationError.default;
6-
7-
// Todo remove this in next major release
8-
module.exports.ValidateError = ValidationError.default;

src/validate.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,8 @@ function filterErrors(errors) {
140140
return newErrors;
141141
}
142142

143+
// TODO change after resolve https://github.com/microsoft/TypeScript/issues/34994
144+
validate.ValidationError = ValidationError;
145+
validate.ValidateError = ValidationError;
146+
143147
export default validate;

0 commit comments

Comments
 (0)