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

failed to generate with intersection type #1246

Closed
ryoppippi opened this issue Aug 28, 2024 · 1 comment
Closed

failed to generate with intersection type #1246

ryoppippi opened this issue Aug 28, 2024 · 1 comment

Comments

@ryoppippi
Copy link
Contributor

Bug Report

Note that, the bug you're reporting may have registered in the issues by another user. Even the bug you're reporting may have been fixed in the @next version. In such reasons, I recommend you to check the old issues and reproduct your code with the @next version before publishing the bug reporting issue.

`npm install --save-dev typia@next`

When the same error occurs even in the @next version, then please fill the below template:

📝 Summary

Write a short summary of the bug in here.

  • Typia Version: 6.9

maybe duplication of #911?

> pnpm typia generate --input src/templates --output src/generated
- JsonObject[key]: string & __type & __type.o1
  - nonsensible intersection

- JsonObject[key]: string & Array<JsonValue>
  - nonsensible intersection

- JsonObject[key]: string & ReadonlyArray<JsonValue>
  - nonsensible intersection

- JsonObject[key]: number & __type & __type.o1
  - nonsensible intersection

- JsonObject[key]: number & Array<JsonValue>
  - nonsensible intersection

- JsonObject[key]: number & ReadonlyArray<JsonValue>
  - nonsensible intersection

- JsonObject[key]: false & __type & __type.o1
  - nonsensible intersection

- JsonObject[key]: false & Array<JsonValue>
  - nonsensible intersection

- JsonObject[key]: false & ReadonlyArray<JsonValue>
  - nonsensible intersection

- JsonObject[key]: true & __type & __type.o1
  - nonsensible intersection

- JsonObject[key]: true & Array<JsonValue>
  - nonsensible intersection

- JsonObject[key]: true & ReadonlyArray<JsonValue>
  - nonsensible intersection

- JsonObject[key]: __type & __type.o1 & string
  - nonsensible intersection

- JsonObject[key]: __type & __type.o1 & number
  - nonsensible intersection

- JsonObject[key]: __type & __type.o1 & false
  - nonsensible intersection

- JsonObject[key]: __type & __type.o1 & true
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: string & __type & __type.o1
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: string & Array<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: string & ReadonlyArray<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: number & __type & __type.o1
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: number & Array<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: number & ReadonlyArray<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: false & __type & __type.o1
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: false & Array<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: false & ReadonlyArray<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: true & __type & __type.o1
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: true & Array<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: true & ReadonlyArray<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: __type & __type.o1 & string
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: __type & __type.o1 & number
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: __type & __type.o1 & false
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: __type & __type.o1 & true
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: __type & __type.o1 & Array<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: __type & __type.o1 & ReadonlyArray<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: Array<JsonValue> & string
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: Array<JsonValue> & number
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: Array<JsonValue> & false
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: Array<JsonValue> & true
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: Array<JsonValue> & __type & __type.o1
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: Array<JsonValue> & ReadonlyArray<JsonValue>
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: ReadonlyArray<JsonValue> & string
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: ReadonlyArray<JsonValue> & number
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: ReadonlyArray<JsonValue> & false
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: ReadonlyArray<JsonValue> & true
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: ReadonlyArray<JsonValue> & __type & __type.o1
  - nonsensible intersection

- { [x: string]: JsonValue; } & { [x: string]: JsonValue | undefined; }[key]: ReadonlyArray<JsonValue> & Array<JsonValue>
  - nonsensible intersection

- JsonObject[key]: __type & __type.o1 & Array<JsonValue>
  - nonsensible intersection

- JsonObject[key]: __type & __type.o1 & ReadonlyArray<JsonValue>
  - nonsensible intersection

- JsonObject[key]: Array<JsonValue> & string
  - nonsensible intersection

- JsonObject[key]: Array<JsonValue> & number
  - nonsensible intersection

- JsonObject[key]: Array<JsonValue> & false
  - nonsensible intersection

- JsonObject[key]: Array<JsonValue> & true
  - nonsensible intersection

- JsonObject[key]: Array<JsonValue> & __type & __type.o1
  - nonsensible intersection

- JsonObject[key]: Array<JsonValue> & ReadonlyArray<JsonValue>
  - nonsensible intersection

- JsonObject[key]: ReadonlyArray<JsonValue> & string
  - nonsensible intersection

- JsonObject[key]: ReadonlyArray<JsonValue> & number
  - nonsensible intersection

- JsonObject[key]: ReadonlyArray<JsonValue> & false
  - nonsensible intersection

- JsonObject[key]: ReadonlyArray<JsonValue> & true
  - nonsensible intersection

- JsonObject[key]: ReadonlyArray<JsonValue> & __type & __type.o1
  - nonsensible intersection

- JsonObject[key]: ReadonlyArray<JsonValue> & Array<JsonValue>
  - nonsensible intersection
jsh: spawn typia EPERM

This code fails with this error

⏯ Playground Link

I cannot save the code to playground, so I created stackblitz environment
https://stackblitz.com/edit/stackblitz-starters-q9vn4u?file=src%2Ftemplates%2Findex.ts

💻 Code occuring the bug

import typia from 'typia';

/* the blow code a copy from 'type-fest' */
type JsonObject = { [Key in string]: JsonValue } & {
  [Key in string]?: JsonValue | undefined;
};

/**
Matches a JSON array.

@category JSON
*/
type JsonArray = JsonValue[] | readonly JsonValue[];

/**
Matches any valid JSON primitive value.

@category JSON
*/
type JsonPrimitive = string | number | boolean | null;

/**
Matches any valid JSON value.

@see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.

@category JSON
*/
type JsonValue = JsonPrimitive | JsonObject | JsonArray;

/* copy from type-fest ends */

type T = {
  json: JsonObject;
};

export const isRequestData = typia.createIs<T>();
@samchon
Copy link
Owner

samchon commented Dec 2, 2024

Even though typia v7 has started supporting the tagged intersection type, no way to support Array & number like nonsensible case. Cannot establlish validation plan about such types.

@samchon samchon closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2024
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

2 participants