Skip to content

Commit

Permalink
Merge 5ababa4 into 4b96e88
Browse files Browse the repository at this point in the history
  • Loading branch information
ktutnik committed Dec 6, 2022
2 parents 4b96e88 + 5ababa4 commit 9c5a246
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/reflect/src/helpers.ts
Expand Up @@ -87,8 +87,8 @@ interface CreateClassOption {

function createClass(definition: CustomTypeDefinition, opt?: Partial<CreateClassOption>): Class {
class Base { }
const option: CreateClassOption = { extends: Base, name: "DynamicType", genericParams: [], ...opt }
const type = { [option.name]: class extends option.extends { } }[option.name];
const {extends:BaseClass, ...option} = { extends: Base, name: "DynamicType", genericParams: [], ...opt }
const type = { [option.name]: class extends BaseClass { } }[option.name];
(type as any)[IsDynamicType] = true
for (const key in definition) {
Reflect.decorate([decorate.type(definition[key])], type.prototype, key)
Expand Down
2 changes: 1 addition & 1 deletion packages/reflect/src/parser.ts
Expand Up @@ -59,7 +59,7 @@ function getNamesFromAst(nodes: any[]) {

function getCode(fn: Class | Function) {
const code = fn.toString()
if (code.search(/^class(\s*)extends\s*option.extends\s*{\s*}/gm) > -1) {
if (code.search(/^class(\s*)extends\s*BaseClass\s*{\s*}/gm) > -1) {
return "class DynamicClass extends Parent {}"
}
else
Expand Down

0 comments on commit 9c5a246

Please sign in to comment.