Skip to content

Commit

Permalink
refactor: remove Schema type definition of types-joi
Browse files Browse the repository at this point in the history
  • Loading branch information
zanminkian committed Nov 29, 2021
1 parent eb6c448 commit f2093ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/configuration/configuration.ts
@@ -1,5 +1,6 @@
import * as Joi from 'types-joi';
import { InterfaceFrom } from 'types-joi';
import { Schema } from 'joi';

export type Asset = 'string' | AssetEntry;

Expand Down Expand Up @@ -64,7 +65,7 @@ const projectConfigurationSchema = Joi.object({
compilerOptions: compilerOptionsSchema.optional(),
});

export const configurationSchema = Joi.object({
const configurationSchemaOfTypesJoi = Joi.object({
language: Joi.string().default('ts'),
collection: Joi.string().default('@nestjs/schematics'),
sourceRoot: Joi.string().default('src'),
Expand All @@ -77,7 +78,10 @@ export const configurationSchema = Joi.object({
.default({}),
}).required();

export type Configuration = InterfaceFrom<typeof configurationSchema>;
export const configurationSchema =
configurationSchemaOfTypesJoi as unknown as Schema;

export type Configuration = InterfaceFrom<typeof configurationSchemaOfTypesJoi>;

export type ProjectConfiguration = InterfaceFrom<
typeof projectConfigurationSchema
Expand Down
2 changes: 1 addition & 1 deletion lib/configuration/nest-configuration.loader.ts
@@ -1,7 +1,7 @@
import { Reader } from '../readers';
import { Configuration } from './configuration';
import { ConfigurationLoader } from './configuration.loader';
import { Schema } from 'types-joi';
import { Schema } from 'joi';

export class NestConfigurationLoader implements ConfigurationLoader {
constructor(
Expand Down

0 comments on commit f2093ec

Please sign in to comment.