Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type [undefined] has been mapped to [any] because no specific type has been found. #92

Open
coderq opened this issue May 2, 2018 · 6 comments

Comments

@coderq
Copy link

coderq commented May 2, 2018

when I run this command, it always show the message that you have seen in the title.

schemats generate -c mysql://root:12345678@localhost:3306/mydb -o ./test.ts -t article -t book -t subscription -t test_article -t test_book -t test_toc -t test_version -t toc -t tool -t tool_type -t version -s mydb

And the file which has been generated is like this:

export namespace articleFields {
    export type undefined = any;

}

export interface article {
    undefined: articleFields.undefined;

}

export namespace bookFields {
    export type undefined = any;

}

export interface book {
    undefined: bookFields.undefined;

}

export namespace subscriptionFields {
    export type undefined = any;

}

export interface subscription {
    undefined: subscriptionFields.undefined;

}

export namespace test_articleFields {
    export type undefined = any;

}

export interface test_article {
    undefined: test_articleFields.undefined;

}

export namespace test_bookFields {
    export type undefined = any;

}

export interface test_book {
    undefined: test_bookFields.undefined;

}

export namespace test_tocFields {
    export type undefined = any;

}

export interface test_toc {
    undefined: test_tocFields.undefined;

}

export namespace test_versionFields {
    export type undefined = any;

}

export interface test_version {
    undefined: test_versionFields.undefined;

}

export namespace tocFields {
    export type undefined = any;

}

export interface toc {
    undefined: tocFields.undefined;

}

export namespace toolFields {
    export type undefined = any;

}

export interface tool {
    undefined: toolFields.undefined;

}

export namespace tool_typeFields {
    export type undefined = any;

}

export interface tool_type {
    undefined: tool_typeFields.undefined;

}

export namespace versionFields {
    export type undefined = any;

}

export interface version {
    undefined: versionFields.undefined;

}

How can I fix this problem?

node version is 8.9.1
schemats version is 3.0.3

@abenhamdine
Copy link
Contributor

weird
IIRC this message is supposed to happen when an unknowned sql type is found in the schema.
But the message should display that type.

@xiamx
Copy link
Contributor

xiamx commented May 2, 2018

OP could you share the DDL of one of your table (for example test_article)?
Also try running without -s mydb

@talzion12
Copy link

I also encountered this error message when I used postgres' composite types.

For example for this SQL definition:

CREATE TYPE TEST_COMPOSITE as (
  first_name text,
  last_name text
);

CREATE TABLE test (
  id             UUID PRIMARY KEY,
  test_composite TEST_COMPOSITE
);

This typescript is generated:

export namespace testFields {
    export type id = string;
    export type test_composite = any | null;

}

export interface test {
    id: testFields.id;
    test_composite: testFields.test_composite;
}

@sunojvijayan
Copy link

Did anyone find a solution to this?

@xiaoqiang1999
Copy link

I also encountered this problem, and I don't know how to solve it.

@byleese
Copy link

byleese commented Oct 25, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants