Skip to content

Commit

Permalink
fix: remove esModuleInterop from tsconfig (#110) (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
ozyman42 committed Aug 31, 2020
1 parent 6a5d216 commit 2f40154
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions declarations/validate.d.ts
Expand Up @@ -2,7 +2,7 @@ export default validate;
export type JSONSchema4 = import('json-schema').JSONSchema4;
export type JSONSchema6 = import('json-schema').JSONSchema6;
export type JSONSchema7 = import('json-schema').JSONSchema7;
export type ErrorObject = Ajv.ErrorObject;
export type ErrorObject = import('ajv').ErrorObject;
export type Extend = {
formatMinimum?: number | undefined;
formatMaximum?: number | undefined;
Expand All @@ -13,8 +13,8 @@ export type Schema =
| (import('json-schema').JSONSchema4 & Extend)
| (import('json-schema').JSONSchema6 & Extend)
| (import('json-schema').JSONSchema7 & Extend);
export type SchemaUtilErrorObject = Ajv.ErrorObject & {
children?: Ajv.ErrorObject[] | undefined;
export type SchemaUtilErrorObject = import('ajv').ErrorObject & {
children?: import('ajv').ErrorObject[] | undefined;
};
export type PostFormatter = (
formattedError: string,
Expand All @@ -40,5 +40,4 @@ declare namespace validate {
export { ValidationError };
export { ValidationError as ValidateError };
}
import Ajv from 'ajv';
import ValidationError from './ValidationError';
7 changes: 4 additions & 3 deletions src/validate.js
@@ -1,10 +1,11 @@
import Ajv from 'ajv';
import ajvKeywords from 'ajv-keywords';

import addAbsolutePathKeyword from './keywords/absolutePath';

import ValidationError from './ValidationError';

// Use CommonJS require for ajv libs so TypeScript consumers aren't locked into esModuleInterop (see #110).
const Ajv = require('ajv');
const ajvKeywords = require('ajv-keywords');

/** @typedef {import("json-schema").JSONSchema4} JSONSchema4 */
/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */
/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Expand Up @@ -6,7 +6,6 @@
"checkJs": true,
"strict": true,
"types": ["node"],
"esModuleInterop": true,
"resolveJsonModule": true
},
"include": ["./types/**/*", "./src/**/*"]
Expand Down

0 comments on commit 2f40154

Please sign in to comment.