Repository: nestjs/swagger (ts)

Issue:
Error on build using plugin
## I'm submitting a...
<pre><code>[ ] Regression
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
</code></pre>

## Current behavior

When use the plugin with nest (nest-cli.json):
```
{
  "sourceRoot": "src",
  "compilerOptions": {
    "plugins": ["@nestjs/swagger/plugin"]
  }
}
```
And try to run the build on project with command:
`nest build`

The following error happens:
"Error  Cannot read property 'kind' of undefined"

## Expected behavior

Build without the error of 'cannot read property kind of undefined'.

## Minimal reproduction of the problem with instructions

It happens on project NewSchool Backend: https://github.com/NewSchoolBR/newschool-backend

Please uses the branch 'develop' to reproduction.

Change the file nest-cli.json adding the plugin from:
```
{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "plugins": ["@nestjs/swagger/plugin"]
  }
}
```
To:
```
{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src"
}
```

Install the npm packages of project running:
`npm i`

And then run:
`npm run build`

After it the error happens.

## What is the motivation / use case for changing the behavior?

The project cannot use the plugin.

## Environment
<pre><code>Nest version: 6.14.1
 
For Tooling issues:
- Node version: 12.13.0
- Platform: Linux

Others:
- Operating system version: Ubuntu 18.4
- IDE: VS Code
- Package Manager: NPM
</code></pre>


Pull request:
fix(core): error 'kind' of undefined
Solves the error "Error Cannot read property 'kind' of undefined"

Fixes #513

## PR Checklist
Please check if your PR fulfills the following requirements:

- [X] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [X] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
   - I don't think that it is necessary


## PR Type
What kind of change does this PR introduce?

```
[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:
```

## What is the current behavior?

Issue Number: 513

Error on nest build when using plugin

## What is the new behavior?

Build without error.

## Does this PR introduce a breaking change?
```
[ ] Yes
[X] No
```

Patch:
diff --git a/lib/plugin/visitors/model-class.visitor.ts b/lib/plugin/visitors/model-class.visitor.ts
index 87627699..c30909b9 100644
--- a/lib/plugin/visitors/model-class.visitor.ts
+++ b/lib/plugin/visitors/model-class.visitor.ts
@@ -164,7 +164,7 @@ export class ModelClassVisitor extends AbstractFileVisitor {
     if (!type) {
       return undefined;
     }
-    if (ts.isTypeLiteralNode(node.type)) {
+    if (node.type && ts.isTypeLiteralNode(node.type)) {
       const propertyAssignments = Array.from(node.type.members || []).map(
         member => {
           const literalExpr = this.createDecoratorObjectLiteralExpr(


Test patch:
diff --git a/test/plugin/fixtures/create-cat-alt2.dto.ts b/test/plugin/fixtures/create-cat-alt2.dto.ts
new file mode 100644
index 00000000..f4090f02
--- /dev/null
+++ b/test/plugin/fixtures/create-cat-alt2.dto.ts
@@ -0,0 +1,31 @@
+export const createCatDtoAlt2Text = `
+import { CreateDateColumn, UpdateDateColumn, VersionColumn } from 'typeorm';
+
+export abstract class Audit {
+  @CreateDateColumn()
+  createdAt;
+
+  @UpdateDateColumn()
+  updatedAt;
+
+  @VersionColumn()
+  version;
+}
+`;
+
+export const createCatDtoTextAlt2Transpiled = `import { CreateDateColumn, UpdateDateColumn, VersionColumn } from 'typeorm';
+export class Audit {
+    static _OPENAPI_METADATA_FACTORY() {
+        return { createdAt: { required: true, type: () => Object }, updatedAt: { required: true, type: () => Object }, version: { required: true, type: () => Object } };
+    }
+}
+__decorate([
+    CreateDateColumn()
+], Audit.prototype, "createdAt", void 0);
+__decorate([
+    UpdateDateColumn()
+], Audit.prototype, "updatedAt", void 0);
+__decorate([
+    VersionColumn()
+], Audit.prototype, "version", void 0);
+`;
diff --git a/test/plugin/model-class-visitor.spec.ts b/test/plugin/model-class-visitor.spec.ts
index 29488cbc..d6ac8a98 100644
--- a/test/plugin/model-class-visitor.spec.ts
+++ b/test/plugin/model-class-visitor.spec.ts
@@ -4,6 +4,10 @@ import {
   createCatDtoAltText,
   createCatDtoTextAltTranspiled
 } from './fixtures/create-cat-alt.dto';
+import {
+  createCatDtoAlt2Text,
+  createCatDtoTextAlt2Transpiled
+} from './fixtures/create-cat-alt2.dto';
 import {
   createCatDtoText,
   createCatDtoTextTranspiled
@@ -47,4 +51,23 @@ describe('API model properties', () => {
     });
     expect(result.outputText).toEqual(createCatDtoTextAltTranspiled);
   });
+
+  it('should add partial metadata factory when some decorators exist when exist node without type', () => {
+    const options: ts.CompilerOptions = {
+      module: ts.ModuleKind.ESNext,
+      target: ts.ScriptTarget.ESNext,
+      noEmitHelpers: true
+    };
+    const filename = 'create-cat-alt2.dto.ts';
+    const fakeProgram = ts.createProgram([filename], options);
+
+    const result = ts.transpileModule(createCatDtoAlt2Text, {
+      compilerOptions: options,
+      fileName: filename,
+      transformers: {
+        before: [before({ classValidatorShim: true }, fakeProgram)]
+      }
+    });
+    expect(result.outputText).toEqual(createCatDtoTextAlt2Transpiled);
+  });
 });