From 642669f362cac11f95e8a80d2cbd282fab099661 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Tue, 3 Oct 2023 01:59:06 +0900 Subject: [PATCH] Fix #639 - clone mode for `Date` type When native class type like `Date` being used with DTO clone mode of `@nestia/sdk`, SDK generator could not write the exact type of it. This PR fixes such bug. --- packages/core/package.json | 6 +- packages/fetcher/package.json | 2 +- packages/sdk/package.json | 6 +- .../src/generates/internal/SdkDtoGenerator.ts | 23 ++++- test/features/clone-date/nestia.config.ts | 17 ++++ test/features/clone-date/src/Backend.ts | 28 ++++++ test/features/clone-date/src/api/HttpError.ts | 1 + .../clone-date/src/api/IConnection.ts | 1 + test/features/clone-date/src/api/Primitive.ts | 1 + .../src/api/functional/date/index.ts | 45 +++++++++ .../clone-date/src/api/functional/index.ts | 7 ++ test/features/clone-date/src/api/index.ts | 4 + test/features/clone-date/src/api/module.ts | 5 + .../src/api/structures/ArrayBufferLike.ts | 1 + .../src/api/structures/IDateDefined.ts | 6 ++ .../clone-date/src/api/structures/__type.ts | 4 + .../clone-date/src/api/structures/buffer.ts | 31 ++++++ .../src/controllers/DateController.ts | 22 +++++ .../api/automated/test_api_date_get.ts | 12 +++ test/features/clone-date/src/test/index.ts | 40 ++++++++ test/features/clone-date/swagger.json | 96 ++++++++++++++++++ test/features/clone-date/tsconfig.json | 98 +++++++++++++++++++ .../date/src/api/structures/IDateDefined.ts | 6 +- test/package.json | 8 +- 24 files changed, 454 insertions(+), 16 deletions(-) create mode 100644 test/features/clone-date/nestia.config.ts create mode 100644 test/features/clone-date/src/Backend.ts create mode 100644 test/features/clone-date/src/api/HttpError.ts create mode 100644 test/features/clone-date/src/api/IConnection.ts create mode 100644 test/features/clone-date/src/api/Primitive.ts create mode 100644 test/features/clone-date/src/api/functional/date/index.ts create mode 100644 test/features/clone-date/src/api/functional/index.ts create mode 100644 test/features/clone-date/src/api/index.ts create mode 100644 test/features/clone-date/src/api/module.ts create mode 100644 test/features/clone-date/src/api/structures/ArrayBufferLike.ts create mode 100644 test/features/clone-date/src/api/structures/IDateDefined.ts create mode 100644 test/features/clone-date/src/api/structures/__type.ts create mode 100644 test/features/clone-date/src/api/structures/buffer.ts create mode 100644 test/features/clone-date/src/controllers/DateController.ts create mode 100644 test/features/clone-date/src/test/features/api/automated/test_api_date_get.ts create mode 100644 test/features/clone-date/src/test/index.ts create mode 100644 test/features/clone-date/swagger.json create mode 100644 test/features/clone-date/tsconfig.json diff --git a/packages/core/package.json b/packages/core/package.json index f5963ef46..e58893ea8 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@nestia/core", - "version": "2.1.5", + "version": "2.1.6", "description": "Super-fast validation decorators of NestJS", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -34,7 +34,7 @@ }, "homepage": "https://nestia.io", "dependencies": { - "@nestia/fetcher": "^2.1.5", + "@nestia/fetcher": "^2.1.6", "@nestjs/common": ">= 7.0.1", "@nestjs/core": ">= 7.0.1", "@nestjs/platform-express": ">= 7.0.1", @@ -47,7 +47,7 @@ "typia": "^5.1.5" }, "peerDependencies": { - "@nestia/fetcher": ">=2.1.5", + "@nestia/fetcher": ">=2.1.6", "@nestjs/common": ">=7.0.1", "@nestjs/core": ">=7.0.1", "@nestjs/platform-express": ">=7.0.1", diff --git a/packages/fetcher/package.json b/packages/fetcher/package.json index 8200107c5..2ab08886c 100644 --- a/packages/fetcher/package.json +++ b/packages/fetcher/package.json @@ -1,6 +1,6 @@ { "name": "@nestia/fetcher", - "version": "2.1.5", + "version": "2.1.6", "description": "Fetcher library of Nestia SDK", "main": "lib/index.js", "typings": "lib/index.d.ts", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 8967b721b..24ca2b76e 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@nestia/sdk", - "version": "2.1.5", + "version": "2.1.6", "description": "Nestia SDK and Swagger generator", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -35,7 +35,7 @@ }, "homepage": "https://nestia.io", "dependencies": { - "@nestia/fetcher": "^2.1.5", + "@nestia/fetcher": "^2.1.6", "cli": "^1.0.1", "glob": "^7.2.0", "path-to-regexp": "^6.2.1", @@ -47,7 +47,7 @@ "typia": "^5.1.5" }, "peerDependencies": { - "@nestia/fetcher": ">=2.1.5", + "@nestia/fetcher": ">=2.1.6", "@nestjs/common": ">=7.0.1", "@nestjs/core": ">=7.0.1", "reflect-metadata": ">=0.1.12", diff --git a/packages/sdk/src/generates/internal/SdkDtoGenerator.ts b/packages/sdk/src/generates/internal/SdkDtoGenerator.ts index 6c0c03c8d..f2ba53ea6 100644 --- a/packages/sdk/src/generates/internal/SdkDtoGenerator.ts +++ b/packages/sdk/src/generates/internal/SdkDtoGenerator.ts @@ -10,6 +10,7 @@ import { MetadataAlias } from "typia/lib/schemas/metadata/MetadataAlias"; import { MetadataArray } from "typia/lib/schemas/metadata/MetadataArray"; import { MetadataAtomic } from "typia/lib/schemas/metadata/MetadataAtomic"; import { MetadataConstant } from "typia/lib/schemas/metadata/MetadataConstant"; +import { MetadataEscaped } from "typia/lib/schemas/metadata/MetadataEscaped"; import { MetadataObject } from "typia/lib/schemas/metadata/MetadataObject"; import { MetadataProperty } from "typia/lib/schemas/metadata/MetadataProperty"; import { MetadataTuple } from "typia/lib/schemas/metadata/MetadataTuple"; @@ -240,13 +241,15 @@ export namespace SdkDtoGenerator { export const decode = (config: INestiaConfig) => (importer: ImportDictionary) => - (meta: Metadata): string => { + (meta: Metadata, parentEscaped: boolean = false): string => { const union: string[] = []; // COALESCES if (meta.any) union.push("any"); if (meta.nullable) union.push("null"); if (meta.isRequired() === false) union.push("undefined"); + if (parentEscaped === false && meta.escaped) + union.push(decodeEscaped(config)(importer)(meta.escaped)); // ATOMICS for (const atomic of meta.atomics) @@ -278,10 +281,26 @@ export namespace SdkDtoGenerator { importer, )(map.value)}>`, ); - return union.join(" | "); }; + const decodeEscaped = + (config: INestiaConfig) => + (importer: ImportDictionary) => + (escaped: MetadataEscaped) => { + if ( + escaped.original.size() === 1 && + escaped.original.natives.length === 1 && + escaped.original.natives[0] === "Date" + ) + return `(string & ${importer.external({ + type: true, + library: `typia/lib/tags/Format`, + instance: "Format", + })}<"date-time">)`; + return `(${decode(config)(importer)(escaped.returns, true)})`; + }; + const decodeTypeTag = (importer: ImportDictionary) => (tag: IMetadataTypeTag): string => { diff --git a/test/features/clone-date/nestia.config.ts b/test/features/clone-date/nestia.config.ts new file mode 100644 index 000000000..aa570f52f --- /dev/null +++ b/test/features/clone-date/nestia.config.ts @@ -0,0 +1,17 @@ +import { INestiaConfig } from "@nestia/sdk"; + +export const NESTIA_CONFIG: INestiaConfig = { + input: ["src/controllers"], + output: "src/api", + e2e: "src/test", + clone: true, + swagger: { + output: "swagger.json", + security: { + bearer: { + type: "apiKey", + }, + }, + }, +}; +export default NESTIA_CONFIG; diff --git a/test/features/clone-date/src/Backend.ts b/test/features/clone-date/src/Backend.ts new file mode 100644 index 000000000..8ab51b70f --- /dev/null +++ b/test/features/clone-date/src/Backend.ts @@ -0,0 +1,28 @@ +import { INestApplication } from "@nestjs/common"; +import { NestFactory } from "@nestjs/core"; + +import core from "@nestia/core"; + +export class Backend { + private application_?: INestApplication; + + public async open(): Promise { + this.application_ = await NestFactory.create( + await core.EncryptedModule.dynamic(__dirname + "/controllers", { + key: "A".repeat(32), + iv: "B".repeat(16), + }), + { logger: false }, + ); + await this.application_.listen(37_000); + } + + public async close(): Promise { + if (this.application_ === undefined) return; + + const app = this.application_; + await app.close(); + + delete this.application_; + } +} diff --git a/test/features/clone-date/src/api/HttpError.ts b/test/features/clone-date/src/api/HttpError.ts new file mode 100644 index 000000000..5df328ae4 --- /dev/null +++ b/test/features/clone-date/src/api/HttpError.ts @@ -0,0 +1 @@ +export { HttpError } from "@nestia/fetcher"; diff --git a/test/features/clone-date/src/api/IConnection.ts b/test/features/clone-date/src/api/IConnection.ts new file mode 100644 index 000000000..107bdb8f8 --- /dev/null +++ b/test/features/clone-date/src/api/IConnection.ts @@ -0,0 +1 @@ +export type { IConnection } from "@nestia/fetcher"; diff --git a/test/features/clone-date/src/api/Primitive.ts b/test/features/clone-date/src/api/Primitive.ts new file mode 100644 index 000000000..60d394424 --- /dev/null +++ b/test/features/clone-date/src/api/Primitive.ts @@ -0,0 +1 @@ +export type { Primitive } from "@nestia/fetcher"; diff --git a/test/features/clone-date/src/api/functional/date/index.ts b/test/features/clone-date/src/api/functional/date/index.ts new file mode 100644 index 000000000..73c20143e --- /dev/null +++ b/test/features/clone-date/src/api/functional/date/index.ts @@ -0,0 +1,45 @@ +/** + * @packageDocumentation + * @module api.functional.date + * @nestia Generated by Nestia - https://github.com/samchon/nestia + */ +//================================================================ +import type { IConnection, Primitive } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; + +import type { IDateDefined } from "../../structures/IDateDefined"; + +/** + * @controller DateController.get + * @path GET /date + * @nestia Generated by Nestia - https://github.com/samchon/nestia + */ +export async function get( + connection: IConnection, +): Promise { + return PlainFetcher.fetch( + connection, + { + ...get.METADATA, + path: get.path(), + } as const, + ); +} +export namespace get { + export type Output = Primitive; + + export const METADATA = { + method: "GET", + path: "/date", + request: null, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; + + export const path = (): string => { + return `/date`; + } +} \ No newline at end of file diff --git a/test/features/clone-date/src/api/functional/index.ts b/test/features/clone-date/src/api/functional/index.ts new file mode 100644 index 000000000..a373556a4 --- /dev/null +++ b/test/features/clone-date/src/api/functional/index.ts @@ -0,0 +1,7 @@ +/** + * @packageDocumentation + * @module api.functional + * @nestia Generated by Nestia - https://github.com/samchon/nestia + */ +//================================================================ +export * as date from "./date"; \ No newline at end of file diff --git a/test/features/clone-date/src/api/index.ts b/test/features/clone-date/src/api/index.ts new file mode 100644 index 000000000..1705f43c8 --- /dev/null +++ b/test/features/clone-date/src/api/index.ts @@ -0,0 +1,4 @@ +import * as api from "./module"; + +export * from "./module"; +export default api; diff --git a/test/features/clone-date/src/api/module.ts b/test/features/clone-date/src/api/module.ts new file mode 100644 index 000000000..dbb6e9a51 --- /dev/null +++ b/test/features/clone-date/src/api/module.ts @@ -0,0 +1,5 @@ +export type * from "./IConnection"; +export type * from "./Primitive"; +export * from "./HttpError"; + +export * as functional from "./functional"; diff --git a/test/features/clone-date/src/api/structures/ArrayBufferLike.ts b/test/features/clone-date/src/api/structures/ArrayBufferLike.ts new file mode 100644 index 000000000..06f7d4171 --- /dev/null +++ b/test/features/clone-date/src/api/structures/ArrayBufferLike.ts @@ -0,0 +1 @@ +export type ArrayBufferLike = ArrayBuffer | SharedArrayBuffer; \ No newline at end of file diff --git a/test/features/clone-date/src/api/structures/IDateDefined.ts b/test/features/clone-date/src/api/structures/IDateDefined.ts new file mode 100644 index 000000000..33a8c8b74 --- /dev/null +++ b/test/features/clone-date/src/api/structures/IDateDefined.ts @@ -0,0 +1,6 @@ +import type { Format } from "typia/lib/tags/Format"; + +export type IDateDefined = { + string: (string & Format<"date-time">); + date: (string & Format<"date-time">); +} \ No newline at end of file diff --git a/test/features/clone-date/src/api/structures/__type.ts b/test/features/clone-date/src/api/structures/__type.ts new file mode 100644 index 000000000..941ca35b4 --- /dev/null +++ b/test/features/clone-date/src/api/structures/__type.ts @@ -0,0 +1,4 @@ +export type __type = { + type: ("Buffer"); + data: Array; +} \ No newline at end of file diff --git a/test/features/clone-date/src/api/structures/buffer.ts b/test/features/clone-date/src/api/structures/buffer.ts new file mode 100644 index 000000000..570d31663 --- /dev/null +++ b/test/features/clone-date/src/api/structures/buffer.ts @@ -0,0 +1,31 @@ +import type { ArrayBufferLike } from "./ArrayBufferLike"; + +export namespace buffer { + export namespace global { + export type Buffer = { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBufferLike; + /** + * The length in bytes of the array. + */ + byteLength: number; + /** + * The offset in bytes of the array. + */ + byteOffset: number; + /** + * The length of the array. + */ + length: number; + "__@toStringTag@398": ("Uint8Array"); + } & { + [key: number]: number; + } + } +} \ No newline at end of file diff --git a/test/features/clone-date/src/controllers/DateController.ts b/test/features/clone-date/src/controllers/DateController.ts new file mode 100644 index 000000000..c21e7f566 --- /dev/null +++ b/test/features/clone-date/src/controllers/DateController.ts @@ -0,0 +1,22 @@ +import core from "@nestia/core"; +import { Controller } from "@nestjs/common"; + +@Controller("date") +export class DateController { + @core.TypedRoute.Get() + public get(): IDateDefined { + return { + string: new Date().toISOString(), + date: new Date(), + }; + } +} + +interface IDateDefined { + /** + * @format date-time + */ + string: string; + + date: Date; +} diff --git a/test/features/clone-date/src/test/features/api/automated/test_api_date_get.ts b/test/features/clone-date/src/test/features/api/automated/test_api_date_get.ts new file mode 100644 index 000000000..7d81d8dc5 --- /dev/null +++ b/test/features/clone-date/src/test/features/api/automated/test_api_date_get.ts @@ -0,0 +1,12 @@ +import typia from "typia"; + +import api from "../../../../api"; + +export const test_api_date_get = async ( + connection: api.IConnection +): Promise => { + const output = await api.functional.date.get( + connection, + ); + typia.assert(output); +}; \ No newline at end of file diff --git a/test/features/clone-date/src/test/index.ts b/test/features/clone-date/src/test/index.ts new file mode 100644 index 000000000..339bdd6a4 --- /dev/null +++ b/test/features/clone-date/src/test/index.ts @@ -0,0 +1,40 @@ +import { DynamicExecutor } from "@nestia/e2e"; + +import { Backend } from "../Backend"; + +async function main(): Promise { + const server: Backend = new Backend(); + await server.open(); + + const report: DynamicExecutor.IReport = await DynamicExecutor.validate({ + extension: __filename.substring(__filename.length - 2), + prefix: "test", + parameters: () => [ + { + host: "http://127.0.0.1:37000", + encryption: { + key: "A".repeat(32), + iv: "B".repeat(16), + }, + }, + ], + })(`${__dirname}/features`); + await server.close(); + + const exceptions: Error[] = report.executions + .filter((exec) => exec.error !== null) + .map((exec) => exec.error!); + if (exceptions.length === 0) { + console.log("Success"); + console.log("Elapsed time", report.time.toLocaleString(), `ms`); + } else { + for (const exp of exceptions) console.log(exp); + console.log("Failed"); + console.log("Elapsed time", report.time.toLocaleString(), `ms`); + process.exit(-1); + } +} +main().catch((exp) => { + console.log(exp); + process.exit(-1); +}); diff --git a/test/features/clone-date/swagger.json b/test/features/clone-date/swagger.json new file mode 100644 index 000000000..4a1fd2188 --- /dev/null +++ b/test/features/clone-date/swagger.json @@ -0,0 +1,96 @@ +{ + "openapi": "3.0.1", + "servers": [ + { + "url": "https://github.com/samchon/nestia", + "description": "insert your server url" + } + ], + "info": { + "version": "0.0.0-dev.20991231", + "title": "@nestia/test", + "description": "Test program of Nestia", + "license": { + "name": "MIT" + } + }, + "paths": { + "/date": { + "get": { + "tags": [], + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IDateDefined" + } + } + }, + "x-nestia-encrypted": false + } + }, + "x-nestia-namespace": "date.get", + "x-nestia-jsDocTags": [], + "x-nestia-method": "GET" + } + } + }, + "components": { + "schemas": { + "IDateDefined": { + "type": "object", + "properties": { + "string": { + "x-typia-jsDocTags": [ + { + "name": "format", + "text": [ + { + "text": "date-time", + "kind": "text" + } + ] + } + ], + "x-typia-required": true, + "x-typia-optional": false, + "type": "string", + "format": "date-time", + "x-typia-typeTags": [ + { + "name": "Format<\"date-time\">", + "target": "string", + "kind": "format", + "value": "date-time", + "validate": "!isNaN(new Date($input).getTime())", + "exclusive": true + } + ] + }, + "date": { + "x-typia-required": true, + "x-typia-optional": false, + "type": "string", + "format": "date-time" + } + }, + "nullable": false, + "required": [ + "string", + "date" + ], + "x-typia-jsDocTags": [] + } + }, + "securitySchemes": { + "bearer": { + "type": "apiKey", + "in": "header", + "name": "Authorization" + } + } + } +} \ No newline at end of file diff --git a/test/features/clone-date/tsconfig.json b/test/features/clone-date/tsconfig.json new file mode 100644 index 000000000..c33dfa28f --- /dev/null +++ b/test/features/clone-date/tsconfig.json @@ -0,0 +1,98 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */// "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + "paths": { + "@api": ["./src/api"], + "@api/lib/*": ["./src/api/*"], + }, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. *//* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true, /* Skip type checking all .d.ts files. */ + "plugins": [ + { "transform": "typescript-transform-paths" }, + { "transform": "typia/lib/transform" }, + { "transform": "@nestia/core/lib/transform" }, + ], + } + } \ No newline at end of file diff --git a/test/features/date/src/api/structures/IDateDefined.ts b/test/features/date/src/api/structures/IDateDefined.ts index dcdd9c2db..3828f2fc2 100644 --- a/test/features/date/src/api/structures/IDateDefined.ts +++ b/test/features/date/src/api/structures/IDateDefined.ts @@ -1,15 +1,15 @@ export interface IDateDefined { /** - * @formt date-time + * @format date-time */ string: string; date: Date; /** - * @formt date-time + * @format date-time */ date_with_tag: Date; date_but_union: Date | Buffer; -} \ No newline at end of file +} diff --git a/test/package.json b/test/package.json index 5e2a689f7..39e32d8cb 100644 --- a/test/package.json +++ b/test/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@nestia/test", - "version": "2.1.5", + "version": "2.1.6", "description": "Test program of Nestia", "main": "index.js", "scripts": { @@ -37,9 +37,9 @@ "typia": "^5.1.5", "uuid": "^9.0.0", "nestia": "^4.5.0", - "@nestia/core": "^2.1.5", + "@nestia/core": "^2.1.6", "@nestia/e2e": "^0.3.6", - "@nestia/fetcher": "^2.1.5", - "@nestia/sdk": "^2.1.5" + "@nestia/fetcher": "^2.1.6", + "@nestia/sdk": "^2.1.6" } } \ No newline at end of file