diff --git a/src/rules/requireExactType.js b/src/rules/requireExactType.js index c49975dc..f6981c8f 100644 --- a/src/rules/requireExactType.js +++ b/src/rules/requireExactType.js @@ -15,9 +15,13 @@ const create = (context) => { return { ObjectTypeAnnotation (node) { - const {exact, indexers} = node; + const { + exact, + indexers, + inexact, + } = node; - if (node.parent.type !== 'InterfaceDeclaration' && always && !exact && indexers.length === 0) { + if (node.parent.type !== 'InterfaceDeclaration' && always && !exact && !inexact && indexers.length === 0) { context.report({ fix: (fixer) => { return [ diff --git a/tests/rules/assertions/requireExactType.js b/tests/rules/assertions/requireExactType.js index 26ff36a1..f68a0f94 100644 --- a/tests/rules/assertions/requireExactType.js +++ b/tests/rules/assertions/requireExactType.js @@ -1,7 +1,6 @@ export default { invalid: [ // Always - { code: 'type foo = {};', errors: [ @@ -137,7 +136,6 @@ export default { valid: [ // Always - { code: 'type foo = {| |};', }, @@ -225,5 +223,11 @@ export default { function?: {| name: string |}; }`, }, + + // Explicit inexact + + { + code: 'type A = { a: string, ... }', + }, ], };