Skip to content

Commit 4fedc8e

Browse files
author
Peter Ullrich
committed
types
1 parent a8aaaf3 commit 4fedc8e

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.1.13",
2+
"version": "0.1.14",
33
"name": "dotup-typescript-yeoman-generators",
44
"author": {
55
"name": "Peter Ullrich",

src/BaseGenerator.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Project } from './project/Project';
1111
import { ProjectInfo } from './project/ProjectInfo';
1212
import { ProjectPathAnalyser } from './project/ProjectPathAnalyser';
1313
import { Question } from './questions/Question';
14-
import { StringProperty, GeneratorOptions, MethodsToRegister } from './Types';
14+
import { GeneratorOptions, MethodsToRegister, IProperty } from './Types';
1515

1616
export abstract class BaseGenerator<TStep extends string> extends generator {
1717

@@ -64,7 +64,7 @@ export abstract class BaseGenerator<TStep extends string> extends generator {
6464
}
6565

6666
setRootPath(): void {
67-
const opt = <StringProperty>this.options;
67+
const opt = <IProperty>this.options;
6868

6969
// We're in the wrong folder, try to set root
7070
if (opt.rootPath && this.destinationPath() !== opt.rootPath) {
@@ -137,7 +137,7 @@ export abstract class BaseGenerator<TStep extends string> extends generator {
137137
}
138138

139139
getDefaultProjectName(): string {
140-
const opt = <StringProperty>this.options;
140+
const opt = <IProperty>this.options;
141141

142142
if (opt.projectName) {
143143
return _.kebabCase(opt.projectName);
@@ -162,10 +162,10 @@ export abstract class BaseGenerator<TStep extends string> extends generator {
162162
.keys(propertyDescriptor)
163163
.map(x => <TStep>x);
164164

165-
const opt = <StringProperty>this.options;
165+
const opt = <IProperty>this.options;
166166
keys.forEach(key => {
167167
if (opt[key] !== undefined) {
168-
(<StringProperty>this.answers)[key] = opt[key];
168+
this.answers[key] = opt[key];
169169
}
170170
});
171171
}

src/Types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { FunctionNamesOnly, TypeSaveProperty, Nested } from 'dotup-ts-types';
22
import { BaseGenerator } from './BaseGenerator';
33

4-
export interface StringProperty {
5-
[key: string]: string;
4+
export interface IProperty extends ITypedProperty<any> {
5+
}
6+
7+
export interface ITypedProperty<T> {
8+
[key: string]: T;
69
}
710

811

test/Question.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Date: 2019-03-19 14:20:20
44
*/
55
import { expect } from 'chai';
6-
import { Question } from '../src/Question';
6+
import { Question } from '../src/questions/Question';
77

88
describe('Test class Question', () => {
99

0 commit comments

Comments
 (0)