Skip to content

Do not reset standard constructors #69

@monolithed

Description

@monolithed
export class String extends TsType<void> {
  constructor() { super(undefined) }
  toString() {
    return 'string'
  }
}
export class Boolean extends TsType<void> {
  constructor() { super(undefined) }
  toString() {
    return 'boolean'
  }
}
export class Number extends TsType<void> {
  constructor() { super(undefined) }
  toString() {
    return 'number'
  }
}
export class Object extends TsType<void> {
  constructor() { super(undefined) }
  toString() {
    return 'Object'
  }
}

export class Array extends TsType<TsType<any>> {
  constructor(value: TsType<any> = new Any) { super(value) }
  toString(settings: Settings) {
    const type = this.value.toType(settings)
    return `${type.indexOf('|') > -1 || type.indexOf('&') > -1 ? `(${type})` : type}[]` // hacky
  }
}
/node_modules/json-schema-to-typescript/dist/TsTypes.js:3
    var extendStatics = Object.setPrototypeOf ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
                              ^

TypeError: Cannot read property 'setPrototypeOf' of undefined
....

/json-schema-to-typescript/dist_tests/src/TsTypes.js:2
Object.defineProperty(exports, "__esModule", { value: true });
^

ReferenceError: Object is not defined
    at Object.<anonymous> (/json-schema-to-typescript/dist_tests/src/TsTypes.js:2:1)
    at Module._compile (module.js:571:32)
    at Module._extensions..js (module.js:580:10)
    at extensions.(anonymous function) (/json-schema-to-typescript/node_modules/require-precompiled/index.js:16:3)

Why do you reset these standard constructors? And how do you build it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions