Repository: nzakas/eslint-plugin-typescript
Pull request #15 (2017-01-05 03:22:41)

New: Add rule no-type-literal
This includes

New rule no-type-literal
Corresponding test
Corresponding documentation
Update to README.md to include the new rule

weirdpattern: Hi @dannyfritz, could you please reference this PR from #5 
Also, please let me know if you need a hand with the some of these rules, I'll be glad to help!
dannyfritz: Which TSLint does this correlate to?
weirdpattern: @JamesHenry I did a couple of modifications to the rule based on the discussion we had few days ago.
Let me know what you think, I believe I cover all possible scenarios, but who knows... 
NeoReyad: @weirdpattern Would it be possible to ignore mapped types (https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types)? Not sure if this has been discussed yet or implemented in the current rule.
weirdpattern: @NeoReyad nope, I did not include mapped types... but it shouldn't be too complicated to implementing.
Now, I know @JamesHenry is waiting on this rule to be merged to do a release, so maybe we can do this in v2 of the rule? 

What do you guys think?
weirdpattern: on second thought, I think I'm gonna work on this tonight... I just realize the code doesn't handle those scenarios properly...
weirdpattern: Ok, I added `allowMappedTypes` to the supported options.
If there are no more comments, this is ready for review!
weirdpattern: Build is failing due to typescript version (2.0.3), works fine with latest version (2.1.x) as mapped types were introduced in this version [release notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html)
JamesHenry: I'm sorry @weirdpattern but we cannot support TS 2.1.x in the parser yet - it is blocked on a TypeScript bug.

See the upgrade issue for more details: https://github.com/eslint/typescript-eslint-parser/issues/128

You will either have to remove the mapped types again or we can wait until after that issue is resolved to move forward with this PR. I'll leave it up to you!
NeoReyad: @weirdpattern I really appreciate the work you done on this plugin and others. Thanks for taking the time to include mapped types. I have looked into the typescript JsDoc bug that is blocking the parser from upgrading. I will try and get a pull request submitted this weekend. Hopefully we can have TypeScript patched and released in a few weeks. 

I think the only part that is breaking is the tests and not the plugin itself since it does not depend on SyntaxKind only the node.type string. Maybe we could just make those tests conditional? 

If you decided to remove the feature that is fine too but it'd be cool if we could include it in a separate typescript 2.1 branch, like we currently do with the parser. This way I could use the mapped type rule today instead of forking the project in my own repo.

Thanks again.


weirdpattern: @NeoReyad it looks like it's going to be a while before we can move to v2.1.x. This [bug](https://github.com/Microsoft/TypeScript/issues/13519) was labeled TypeScript 2.2 and there is no due date yet... 

Re creating a 2.1 branch for this rule (and any other requiring v2.1.x), I'm all for it, but I'm just a contributor here, so I cannot create branches on this repo. I leave the decision to @nzakas and/or @JamesHenry, for now I'm just going to leave this PR as is.
NeoReyad: I see they have marked it as 2.2 milestone which i think is scheduled for march. One of the developer comments mentioned a quick fix. I will see if they can apply it to the 2.1 branch.
weirdpattern: I guess I can remove the mapped types from this PR, then create a new one that includes everything. The latter can be merged once TS 2.2 gets released and the parser supports it.

I will work on this tomorrow.
weirdpattern: @JamesHenry I removed mapped types from this PR, we can merge now.
I will submit a new PR in a second and am going to mark it as 2.1
JamesHenry: Hey @weirdpattern, I am sorry for the insane delay on this. I have just merged in some important updates to the plugin from @corbinu, and released as 0.3.0.

Are you available to update this PR to include all the latest work? 
weirdpattern: @JamesHenry and @corbinu I've added the missing mapped types (see Feb 3 comment few lines above) and rebase the code to include the latest... we should be good to go, let me know otherwise...
JamesHenry: Thanks, @weirdpattern!

Patch:
diff --git a/README.md b/README.md
index d68d2d0..e9b96ea 100644
--- a/README.md
+++ b/README.md
@@ -56,4 +56,5 @@ Then configure the rules you want to use under the rules section.
 * `typescript/no-explicit-any` - enforces the any type is not used.
 * `typescript/no-angle-bracket-type-assertion` - enforces the use of `as Type` assertions instead of `<Type>` assertions.
 * `typescript/no-namespace` - disallows the use of custom TypeScript modules and namespaces.
-* `typescript/prefer-namespace-keyword` - enforces the use of the keyword `namespace` over `module` to declare custom TypeScript modules.
\ No newline at end of file
+* `typescript/prefer-namespace-keyword` - enforces the use of the keyword `namespace` over `module` to declare custom TypeScript modules.
+* `typescript/no-type-literal` - disallows the use of type aliases.
diff --git a/docs/rules/no-type-alias.md b/docs/rules/no-type-alias.md
new file mode 100644
index 0000000..87454bc
--- /dev/null
+++ b/docs/rules/no-type-alias.md
@@ -0,0 +1,502 @@
+# Disallows the use of type aliases. 
+
+In TypeScript, type aliases serve three purposes:
+- Aliasing other types so that we can refer to them using a simpler name.
+
+```ts
+// this...
+type Person = {
+    firstName: string,
+    lastName: string,
+    age: number
+};
+ 
+function addPerson(person : Person) { ... }
+ 
+// is easier to read than this...
+function addPerson(person : { firstName: string, lastName: string, age: number}) { ... } 
+```
+- Act sort of like an interface, providing a set of methods and properties that must exist 
+in the objects implementing the type.
+
+```ts
+type Person = {
+    firstName: string,
+    lastName: string,
+    age: number,
+    walk: () => void,
+    talk: () => void
+};
+ 
+// you know person will have 3 properties and 2 methods, 
+// because the structure has already been defined.
+var person : Person = { ... }
+ 
+// so we can be sure that this will work 
+person.walk();
+```
+
+- Act like mapping tools between types to allow quick modifications.
+
+```ts
+type Immutable<T> = {
+    readonly [P in keyof T] : T[P]
+}
+
+type Person = {
+    name: string,
+    age: number
+}
+
+type ImmutablePerson = Immutable<Person>;
+
+var person : ImmutablePerson = { name: 'John', age: 30 };
+person.name = 'Brad'; // error, readonly property
+```
+
+When aliasing, the type alias does not create a new type, it just creates a new name 
+to refer to the original type. So aliasing primitives and other simple types, tuples, unions
+or intersections can some times be redundant. 
+
+```ts
+// this doesn't make much sense
+type myString = string;
+```
+
+On the other hand, using a type alias as an interface can limit your ability to:
+- Reuse your code: interfaces can be extended or implemented by other types. Type aliases cannot.
+- Debug your code: interfaces create a new name, so is easy to identify the base type of an object 
+while debugging the application.   
+
+Finally, mapping types is an advance technique, leaving it open can quickly become a pain point 
+in your application.
+
+## Rule Details
+
+This rule disallows the use of type aliases in favor of interfaces 
+and simplified types (primitives, tuples, unions, intersections, etc).
+
+## Options
+This rule, in its default state, does not require any argument. If you would like to enable one 
+or more of the following you may pass an object with the options set as follows:
+- `allowAliases` set to `true` or `"always"` will allow you to do aliasing (Defaults to `false`/`"never"`).
+- `allowCallbacks` set to `true` or `"always"` will allow you to use type aliases with callbacks (Defaults to `false`/`"never"`)
+- `allowLiterals` set to `true` or `"always"` will allow you to use type aliases with literal objects (Defaults to `false`/`"never"`)
+- `allowMappedTypes` set to `true` or `"always"` will allow you to use type aliases as mapping tools (Defaults to `false`/`"never"`)
+
+### allowAliases
+This applies to primitive types and reference types.
+
+The setting accepts the following values:
+- `true` or `false` (`"always"` or `"never"`) to active or deactivate the feature.
+- `"in-unions"`, allows aliasing in union statements, e.g. `type Foo = string | string[];`
+- `"in-intersections"`, allows aliasing in intersection statements, e.g. `type Foo = string & string[];`
+- `"in-unions-and-intersections"`, allows aliasing in union and/or intersection statements.
+
+Examples of **correct** code for the `{ "allowAliases": true }` or `{ "allowAliases": "always" }` options:
+```ts
+// primitives
+type Foo = 'a';
+ 
+type Foo = 'a' | 'b';
+ 
+type Foo = string;
+ 
+type Foo = string | string[];
+ 
+type Foo = string & string[];
+ 
+// reference types
+interface Bar {}
+class Baz implements Bar {}
+ 
+type Foo = Bar;
+ 
+type Foo = Bar | Baz;
+ 
+type Foo = Bar & Baz;
+```
+
+Examples of **incorrect** code for the `{ "allowAliases": "in-unions" }` option:
+```ts
+// primitives
+type Foo = 'a';
+ 
+type Foo = string;
+ 
+type Foo = string & string[];
+ 
+// reference types
+interface Bar {}
+class Baz implements Bar {}
+ 
+type Foo = Bar;
+ 
+type Foo = Bar & Baz;
+```
+
+Examples of **correct** code for the `{ "allowAliases": "in-unions" }` option:
+```ts
+// primitives
+type Foo = 'a' | 'b';
+ 
+type Foo = string | string[];
+ 
+// reference types
+interface Bar {}
+class Baz implements Bar {}
+  
+type Foo = Bar | Baz;
+```
+
+Examples of **incorrect** code for the `{ "allowAliases": "in-intersections" }` option:
+```ts
+// primitives
+type Foo = 'a';
+ 
+type Foo = 'a' | 'b';
+ 
+type Foo = string;
+ 
+type Foo = string | string[];
+ 
+// reference types
+interface Bar {}
+class Baz implements Bar {}
+ 
+type Foo = Bar;
+  
+type Foo = Bar | Baz;
+```
+
+Examples of **correct** code for the `{ "allowAliases": "in-intersections" }` option:
+```ts
+// primitives
+type Foo = string & string[];
+ 
+// reference types
+interface Bar {}
+class Baz implements Bar {}
+ 
+type Foo = Bar & Baz;
+```
+
+Examples of **incorrect** code for the `{ "allowAliases": "in-unions-and-intersections" }` option:
+```ts
+// primitives
+type Foo = 'a';
+ 
+type Foo = string;
+ 
+// reference types
+interface Bar {}
+class Baz implements Bar {}
+ 
+type Foo = Bar;
+```
+
+Examples of **correct** code for the `{ "allowAliases": "in-unions-and-intersections" }` option:
+```ts
+// primitives
+type Foo = 'a' | 'b';
+ 
+type Foo = string | string[];
+ 
+type Foo = string & string[];
+ 
+// reference types
+interface Bar {}
+class Baz implements Bar {}
+ 
+type Foo = Bar | Baz;
+ 
+type Foo = Bar & Baz;
+```
+
+### allowCallbacks
+This applies to function types.
+
+The setting accepts the following values:
+- `true` or `false` (`"always"` or `"never"`) to active or deactivate the feature.
+
+Examples of **correct** code for the `{ "allowCallbacks": true }` or `{ "allowCallbacks": "always" }` option:
+```ts
+type Foo = () => void;
+ 
+type Foo = (name: string) => string;
+ 
+class Person {}
+ 
+type Foo = (name: string, age: number) => string | Person;
+ 
+type Foo = (name: string, age: number) => string & Person;
+```
+
+### allowsLiterals
+This applies to literal types (`type Foo = { ... }`).
+
+The setting accepts the following options:
+- `true` or `false` (`"always"` or `"never"`) to active or deactivate the feature.
+- `"in-unions"`, allows literals in union statements, e.g. `type Foo = string | string[];`
+- `"in-intersections"`, allows literals in intersection statements, e.g. `type Foo = string & string[];`
+- `"in-unions-and-intersections"`, allows literals in union and/or intersection statements.
+
+Examples of **correct** code for the `{ "allowLiterals": true }` or `{ "allowLiterals": "always" }` options:
+```ts
+type Foo = {};
+ 
+type Foo = {
+    name: string,
+    age: number
+};
+ 
+type Foo = {
+    name: string,
+    age: number,
+    walk: (miles: number) => void
+};
+ 
+type Foo = { name: string } | { age: number };
+ 
+type Foo = { name: string } & { age: number };
+```
+
+Examples of **incorrect** code for the `{ "allowLiterals": "in-unions" }` option:
+```ts
+type Foo = {};
+ 
+type Foo = {
+    name: string,
+    age: number
+};
+ 
+type Foo = {
+    name: string,
+    age: number,
+    walk: (miles: number) => void
+};
+ 
+type Foo = { name: string } & { age: number };
+```
+
+Examples of **correct** code for the `{ "allowLiterals": "in-unions" }` option:
+```ts
+type Foo = { name: string } | { age: number };
+```
+
+Examples of **incorrect** code for the `{ "allowLiterals": "in-intersections" }` option:
+```ts
+type Foo = {};
+ 
+type Foo = {
+    name: string,
+    age: number
+};
+ 
+type Foo = {
+    name: string,
+    age: number,
+    walk: (miles: number) => void
+};
+ 
+type Foo = { name: string } | { age: number };
+```
+
+Examples of **correct** code for the `{ "allowLiterals": "in-intersections" }` option:
+```ts
+type Foo = { name: string } & { age: number };
+```
+
+Examples of **incorrect** code for the `{ "allowLiterals": "in-unions-and-intersections" }` option:
+```ts
+type Foo = {};
+ 
+type Foo = {
+    name: string,
+    age: number
+};
+ 
+type Foo = {
+    name: string,
+    age: number,
+    walk: (miles: number) => void
+};
+```
+
+Examples of **correct** code for the `{ "allowLiterals": "in-unions-and-intersections" }` option:
+```ts
+type Foo = { name: string } | { age: number };
+ 
+type Foo = { name: string } & { age: number };
+```
+
+### allowMappedTypes
+This applies to literal types.
+
+The setting accepts the following values:
+- `true` or `false` (`"always"` or `"never"`) to active or deactivate the feature.
+- `"in-unions"`, allows aliasing in union statements, e.g. `type Foo = string | string[];`
+- `"in-intersections"`, allows aliasing in intersection statements, e.g. `type Foo = string & string[];`
+- `"in-unions-and-intersections"`, allows aliasing in union and/or intersection statements.
+
+Examples of **correct** code for the `{ "allowMappedTypes": true }` or `{ "allowMappedTypes": "always" }` options:
+```ts
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+ 
+type Foo<T> = {
+    [P in keyof T]? : T[P]
+};
+ 
+type Foo<T, U> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof U] : U[P]
+};
+ 
+type Foo<T, U> = {
+    [P in keyof T]? : T[P]
+} | {
+    [P in keyof U]? : U[P]
+};
+ 
+type Foo<T, U> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof U] : U[P]
+};
+ 
+type Foo<T, U> = {
+    [P in keyof T]? : T[P]
+} & {
+    [P in keyof U]? : U[P]
+};
+```
+
+Examples of **incorrect** code for the `{ "allowMappedTypes": "in-unions" }` option:
+```ts
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+ 
+type Foo<T> = {
+    [P in keyof T]? : T[P]
+};
+ 
+type Foo<T, U> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof U] : U[P]
+};
+ 
+type Foo<T, U> = {
+    [P in keyof T]? : T[P]
+} & {
+    [P in keyof U]? : U[P]
+};
+```
+
+Examples of **correct** code for the `{ "allowMappedTypes": "in-unions" }` option:
+```ts
+type Foo<T, U> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof U] : U[P]
+};
+ 
+type Foo<T, U> = {
+    [P in keyof T]? : T[P]
+} | {
+    [P in keyof U]? : U[P]
+};
+```
+
+Examples of **incorrect** code for the `{ "allowMappedTypes": "in-intersections" }` option:
+```ts
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+ 
+type Foo<T> = {
+    [P in keyof T]? : T[P]
+};
+  
+type Foo<T, U> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof U] : U[P]
+};
+ 
+type Foo<T, U> = {
+    [P in keyof T]? : T[P]
+} | {
+    [P in keyof U]? : U[P]
+};
+```
+
+Examples of **correct** code for the `{ "allowMappedTypes": "in-intersections" }` option:
+```ts
+type Foo<T, U> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof U] : U[P]
+};
+ 
+type Foo<T, U> = {
+    [P in keyof T]? : T[P]
+} & {
+    [P in keyof U]? : U[P]
+};
+```
+
+Examples of **incorrect** code for the `{ "allowMappedTypes": "in-unions-and-intersections" }` option:
+```ts
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+ 
+type Foo<T> = {
+    [P in keyof T]? : T[P]
+};
+```
+
+Examples of **correct** code for the `{ "allowMappedTypes": "in-unions-and-intersections" }` option:
+```ts
+type Foo<T, U> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof U] : U[P]
+};
+ 
+type Foo<T, U> = {
+    [P in keyof T]? : T[P]
+} | {
+    [P in keyof U]? : U[P]
+};
+ 
+type Foo<T, U> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof U] : U[P]
+};
+  
+type Foo<T, U> = {
+    [P in keyof T]? : T[P]
+} & {
+    [P in keyof U]? : U[P]
+};
+```
+
+## When Not To Use It
+
+When you can't express some shape with an interface or you need to use a union, tuple type, 
+callback, etc. that would cause the code to be unreadable or impractical.
+
+## Further Reading
+
+* [Advance Types](https://www.typescriptlang.org/docs/handbook/advanced-types.html)
+
+## Related to
+
+* TSLint: [interface-over-type-literal](https://palantir.github.io/tslint/rules/interface-over-type-literal/)
diff --git a/lib/rules/no-type-alias.js b/lib/rules/no-type-alias.js
new file mode 100644
index 0000000..5ef0498
--- /dev/null
+++ b/lib/rules/no-type-alias.js
@@ -0,0 +1,257 @@
+/**
+ * @fileoverview Disallows the use of type aliases.
+ * @author Patricio Trevino
+ */
+"use strict";
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+    meta: {
+        docs: {
+            description: "Disallows the use of type aliases.",
+            category: "TypeScript"
+        },
+        schema: [
+            {
+                type: "object",
+                properties: {
+                    allowAliases: {
+                        enum: [
+                            true,
+                            false,
+                            "always",
+                            "never",
+                            "in-unions",
+                            "in-intersections",
+                            "in-unions-and-intersections"
+                        ]
+                    },
+                    allowCallbacks: {
+                        enum: [
+                            true,
+                            false,
+                            "always",
+                            "never"
+                        ]
+                    },
+                    allowLiterals: {
+                        enum: [
+                            true,
+                            false,
+                            "always",
+                            "never",
+                            "in-unions",
+                            "in-intersections",
+                            "in-unions-and-intersections"
+                        ]
+                    },
+                    allowMappedTypes: {
+                        enum: [
+                            true,
+                            false,
+                            "always",
+                            "never",
+                            "in-unions",
+                            "in-intersections",
+                            "in-unions-and-intersections"
+                        ]
+                    }
+                },
+                additionalProperties: false
+            }
+        ]
+    },
+
+    create(context) {
+        const options = context.options[0];
+
+        const allowAliases = options && options.allowAliases || "never";
+        const allowCallbacks = options && options.allowCallbacks || "never";
+        const allowLiterals = options && options.allowLiterals || "never";
+        const allowMappedTypes = options && options.allowMappedTypes || "never";
+
+        const unions = [true, "always", "in-unions", "in-unions-and-intersections"];
+        const intersections = [true, "always", "in-intersections", "in-unions-and-intersections"];
+        const compositions = ["in-unions", "in-intersections", "in-unions-and-intersections"];
+        const aliasTypes = ["TSLastTypeNode", "TSArrayType", "TSTypeReference"];
+
+        //----------------------------------------------------------------------
+        // Helpers
+        //----------------------------------------------------------------------
+
+        /**
+         * Determines if the given node is a union or an intersection.
+         * @param {TSNode} node the node to be evaluated.
+         * @returns {boolean} true when node if a union or intersection.
+         * @private
+         */
+        function isComposition(node) {
+            return node && (node.type === "TSUnionType" || node.type === "TSIntersectionType");
+        }
+
+        /**
+         * Determines if the composition type is supported by the allowed flags.
+         * @param {boolean} isTopLevel a flag indicating this is the top level node.
+         * @param {string} compositionType the composition type (either TSUnionType or TSIntersectionType)
+         * @param {string} allowed the currently allowed flags.
+         * @returns {boolean} true if the composition type supported by the allowed flags.
+         * @private
+         */
+        function isSupportedComposition(isTopLevel, compositionType, allowed) {
+            return compositions.indexOf(allowed) === -1 || (!isTopLevel && (
+                (compositionType === "TSUnionType" && unions.indexOf(allowed) > -1) ||
+                (compositionType === "TSIntersectionType" && intersections.indexOf(allowed) > -1)
+            ));
+        }
+
+        /**
+         * Determines if the given node is an alias type (keywords, arrays, type references and constants).
+         * @param {TSNode} node the node to be evaluated.
+         * @returns {boolean} true when the node is an alias type.
+         * @private
+         */
+        function isAlias(node) {
+            return node && (/Keyword$/.test(node.type) || aliasTypes.indexOf(node.type) > -1);
+        }
+
+        /**
+         * Determines if the given node is a callback type.
+         * @param {TSNode} node the node to be evaluated.
+         * @returns {boolean} true when the node is a callback type.
+         * @private
+         */
+        function isCallback(node) {
+            return node && node.type === "TSFunctionType";
+        }
+
+        /**
+         * Determines if the given node is a literal type (objects).
+         * @param {TSNode} node the node to be evaluated.
+         * @returns {boolean} true when the node is a literal type (object).
+         * @private
+         */
+        function isLiteral(node) {
+            return node && node.type === "TSTypeLiteral";
+        }
+
+        /**
+         * Determines if the given node is a mapped type.
+         * @param {TSNode} node the node to be evaluated.
+         * @returns {boolean} true when the node is a mapped type.
+         * @private
+         */
+        function isMappedType(node) {
+            return node && node.type === "TSMappedType";
+        }
+
+        /**
+         * Gets the message to be displayed based on the node type and whether the node is a top level declaration.
+         * @param {string} compositionType the type of composition this alias is part of (undefined if not
+         *                                  part of a composition)
+         * @param {boolean} isRoot a flag indicating we are dealing with the top level declaration.
+         * @param {string} type the kind of type alias being validated.
+         * @returns {string} the message to be displayed.
+         * @private
+         */
+        function getMessage(compositionType, isRoot, type) {
+            if (isRoot) {
+                return type ? `Type ${type} are not allowed` : "Type aliases are not allowed";
+            }
+
+            return compositionType === "TSUnionType"
+                ? `${type[0].toUpperCase()}${type.substring(1)} in union types are not allowed`
+                : `${type[0].toUpperCase()}${type.substring(1)} in intersection types are not allowed`;
+        }
+
+        /**
+         * Validates the node looking for aliases, callbacks and literals.
+         * @param {TSNode} node the node to be validated.
+         * @param {boolean} isTopLevel a flag indicating this is the top level node.
+         * @param {boolean} compositionType the type of composition this alias is part of (undefined if not
+         *                                  part of a composition)
+         * @returns {void}
+         * @private
+         */
+        function validateTypeAliases(node, isTopLevel, compositionType) {
+            if (isAlias(node)) {
+                if (allowAliases === "never" || (!isSupportedComposition(isTopLevel, compositionType, allowAliases))) {
+                    context.report({
+                        node,
+                        message: getMessage(compositionType, isTopLevel, "aliases")
+                    });
+                }
+            } else if (isCallback(node)) {
+                if (allowCallbacks === "never") {
+                    context.report({
+                        node,
+                        message: getMessage(compositionType, isTopLevel, "callbacks")
+                    });
+                }
+            } else if (isLiteral(node)) {
+                if (allowLiterals === "never" || (!isSupportedComposition(isTopLevel, compositionType, allowLiterals))) {
+                    context.report({
+                        node,
+                        message: getMessage(compositionType, isTopLevel, "literals")
+                    });
+                }
+            } else if (isMappedType(node)) {
+                if (allowMappedTypes === "never" || (!isSupportedComposition(isTopLevel, compositionType, allowMappedTypes))) {
+                    context.report({
+                        node,
+                        message: getMessage(compositionType, isTopLevel, "mapped types")
+                    });
+                }
+            } else {
+                context.report({
+                    node,
+                    message: getMessage(compositionType, isTopLevel)
+                });
+            }
+        }
+
+        /**
+         * Validates compositions (unions and/or intersections).
+         * @param {TSNode} node the node to be validated.
+         * @returns {void}
+         * @private
+         */
+        function validateCompositions(node) {
+            node.types.forEach(type => {
+                if (isComposition(type)) {
+                    validateCompositions(type);
+                } else {
+                    validateTypeAliases(type, false, node.type);
+                }
+            });
+        }
+
+        /**
+         * Validates the node looking for compositions, aliases, callbacks and literals.
+         * @param {TSNode} node the node to be validated.
+         * @param {boolean} isTopLevel a flag indicating this is the top level node.
+         * @returns {void}
+         * @private
+         */
+        function validateNode(node, isTopLevel) {
+            if (isComposition(node)) {
+                validateCompositions(node);
+            } else {
+                validateTypeAliases(node, isTopLevel);
+            }
+        }
+
+        //----------------------------------------------------------------------
+        // Public
+        //----------------------------------------------------------------------
+        return {
+            VariableDeclaration(node) {
+                if (node.kind === "type") {
+                    validateNode(node.declarations[0].init, true);
+                }
+            }
+        };
+    }
+};


Test patch:
diff --git a/tests/lib/rules/no-type-alias.js b/tests/lib/rules/no-type-alias.js
new file mode 100644
index 0000000..8ef1a70
--- /dev/null
+++ b/tests/lib/rules/no-type-alias.js
@@ -0,0 +1,2933 @@
+/**
+ * @fileoverview Disallows the use of type aliases.
+ * @author Patricio Trevino
+ */
+"use strict";
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+var rule = require("../../../lib/rules/no-type-alias"),
+    RuleTester = require("eslint").RuleTester;
+
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+var ruleTester = new RuleTester();
+ruleTester.run("no-type-alias", rule, {
+
+    valid: [
+        {
+            code: "type Foo = 'a';",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a';",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowAliases: true}],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2;",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2 | 3;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2 | 3;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2 | 3;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2 | 3;",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 & 2;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 & 2;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 & 2;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 & 2;",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 & 2 & 3;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 & 2 & 3;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 & 2 & 3;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 & 2 & 3;",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2 & 3;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2 & 3;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = 1 | 2 & 3;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = true;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = true;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = true | false;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = true | false;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = true | false;",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = true & false;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = true & false;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = true & false;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = true & false;",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | string;
+            `,
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | string;
+            `,
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | string;
+            `,
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | string;
+            `,
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & string;
+            `,
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & string;
+            `,
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & string;
+            `,
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & string;
+            `,
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string & string[];",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string & string[];",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string & string[];",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string & string[];",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string & string[] & number;",
+            options: [{ allowAliases: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string & string[] & number;",
+            options: [{ allowAliases: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string & string[] & number;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = string & string[] & number;",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = () => void;",
+            options: [{ allowCallbacks: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = () => void;",
+            options: [{ allowCallbacks: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = () => void | string;",
+            options: [{ allowCallbacks: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {} | {};",
+            options: [{ allowLiterals: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {} | {};",
+            options: [{ allowLiterals: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {} | {};",
+            options: [{ allowLiterals: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {} | {};",
+            options: [{ allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {} & {};",
+            options: [{ allowLiterals: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {} & {};",
+            options: [{ allowLiterals: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {} & {};",
+            options: [{ allowLiterals: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "type Foo = {} & {};",
+            options: [{ allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "in-unions" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: true }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "always" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "in-intersections" }],
+            parser: "typescript-eslint-parser"
+        }
+    ],
+    invalid: [
+        {
+            code: "type Foo = 'a'",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a'",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a'",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowAliases: false, allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowAliases: "never", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b';",
+            options: [{ allowAliases: "in-intersections", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: false, allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: "never", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' | 'c';",
+            options: [{ allowAliases: "in-intersections", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: false, allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: "never", allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b';",
+            options: [{ allowAliases: "in-unions", allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: false, allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: "never", allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' & 'b' & 'c';",
+            options: [{ allowAliases: "in-unions", allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: false, allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: "never", allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: "in-unions", allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 24
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = 'a' | 'b' & 'c';",
+            options: [{ allowAliases: "in-intersections", allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = string;",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = string;",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = string;",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = string;",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = string;",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = string;",
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[];",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowAliases: false, allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowAliases: "never", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[];",
+            options: [{ allowAliases: "in-intersections", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: false, allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: "never", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] | number;",
+            options: [{ allowAliases: "in-intersections", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            options: [{ allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            options: [{ allowAliases: false, allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            options: [{ allowAliases: "never", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            options: [{ allowAliases: "in-unions", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = string | string[] & number;",
+            options: [{ allowAliases: "in-intersections", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar;
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar;
+            `,
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar;
+            `,
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar;
+            `,
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar;
+            `,
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar;
+            `,
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type aliases are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | {};
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | {};
+            `,
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | {};
+            `,
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | {};
+            `,
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | {};
+            `,
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar | {};
+            `,
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & {};
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & {};
+            `,
+            options: [{ allowAliases: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & {};
+            `,
+            options: [{ allowAliases: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & {};
+            `,
+            options: [{ allowAliases: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & {};
+            `,
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: `
+interface Bar {}
+type Foo = Bar & {};
+            `,
+            options: [{ allowAliases: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 18
+                }
+            ]
+        },
+        {
+            code: "type Foo = () => void;",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type callbacks are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = () => void;",
+            options: [{ allowCallbacks: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type callbacks are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = () => void;",
+            options: [{ allowCallbacks: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type callbacks are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: false, allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: "never", allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: "in-unions", allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: "in-intersections", allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {};",
+            options: [{ allowLiterals: "in-unions-and-intersections", allowAliases: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type literals are not allowed",
+                    row: 1,
+                    column: 12
+                }
+            ]
+        },
+        {
+            code: "type Foo = {} | {};",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 17
+                }
+            ]
+        },
+        {
+            code: "type Foo = {} | {};",
+            options: [{ allowLiterals: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 17
+                }
+            ]
+        },
+        {
+            code: "type Foo = {} | {};",
+            options: [{ allowLiterals: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 17
+                }
+            ]
+        },
+        {
+            code: "type Foo = {} | {};",
+            options: [{ allowLiterals: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in union types are not allowed",
+                    row: 1,
+                    column: 17
+                }
+            ]
+        },
+        {
+            code: "type Foo = {} & {};",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 17
+                }
+            ]
+        },
+        {
+            code: "type Foo = {} & {};",
+            options: [{ allowLiterals: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 17
+                }
+            ]
+        },
+        {
+            code: "type Foo = {} & {};",
+            options: [{ allowLiterals: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 17
+                }
+            ]
+        },
+        {
+            code: "type Foo = {} & {};",
+            options: [{ allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 17
+                }
+            ]
+        },
+        {
+            code: "type Foo = string & {} | 'a' | 1;",
+            options: [{ allowAliases: "in-unions", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Aliases in intersection types are not allowed",
+                    row: 1,
+                    column: 12
+                },
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                }
+            ]
+        },
+        {
+            code: "type Foo = string & {} | 'a' | 1;",
+            options: [{ allowAliases: "in-intersections", allowLiterals: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Literals in intersection types are not allowed",
+                    row: 1,
+                    column: 21
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 26
+                },
+                {
+                    message: "Aliases in union types are not allowed",
+                    row: 1,
+                    column: 32
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type mapped types are not allowed",
+                    row: 1,
+                    column: 15
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type mapped types are not allowed",
+                    row: 1,
+                    column: 15
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type mapped types are not allowed",
+                    row: 1,
+                    column: 15
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type mapped types are not allowed",
+                    row: 1,
+                    column: 15
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type mapped types are not allowed",
+                    row: 1,
+                    column: 15
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "in-unions-and-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Type mapped types are not allowed",
+                    row: 1,
+                    column: 15
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Mapped types in union types are not allowed",
+                    row: 1,
+                    column: 15
+                },
+                {
+                    message: "Mapped types in union types are not allowed",
+                    row: 4,
+                    column: 5
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Mapped types in union types are not allowed",
+                    row: 1,
+                    column: 15
+                },
+                {
+                    message: "Mapped types in union types are not allowed",
+                    row: 4,
+                    column: 5
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Mapped types in union types are not allowed",
+                    row: 1,
+                    column: 15
+                },
+                {
+                    message: "Mapped types in union types are not allowed",
+                    row: 4,
+                    column: 5
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} | {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "in-intersections" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Mapped types in union types are not allowed",
+                    row: 1,
+                    column: 15
+                },
+                {
+                    message: "Mapped types in union types are not allowed",
+                    row: 4,
+                    column: 5
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Mapped types in intersection types are not allowed",
+                    row: 1,
+                    column: 15
+                },
+                {
+                    message: "Mapped types in intersection types are not allowed",
+                    row: 4,
+                    column: 5
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: false }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Mapped types in intersection types are not allowed",
+                    row: 1,
+                    column: 15
+                },
+                {
+                    message: "Mapped types in intersection types are not allowed",
+                    row: 4,
+                    column: 5
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "never" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Mapped types in intersection types are not allowed",
+                    row: 1,
+                    column: 15
+                },
+                {
+                    message: "Mapped types in intersection types are not allowed",
+                    row: 4,
+                    column: 5
+                }
+            ]
+        },
+        {
+            code: `
+type Foo<T> = {
+    readonly [P in keyof T] : T[P]
+} & {
+    readonly [P in keyof T] : T[P]
+};
+            `,
+            options: [{ allowMappedTypes: "in-unions" }],
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Mapped types in intersection types are not allowed",
+                    row: 1,
+                    column: 15
+                },
+                {
+                    message: "Mapped types in intersection types are not allowed",
+                    row: 4,
+                    column: 5
+                }
+            ]
+        }
+    ]
+});