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

Reuse is functions for code size #1406

Open
miyaji255 opened this issue Dec 2, 2024 · 1 comment
Open

Reuse is functions for code size #1406

miyaji255 opened this issue Dec 2, 2024 · 1 comment
Assignees
Labels
duplicate This issue or pull request already exists help wanted Extra attention is needed

Comments

@miyaji255
Copy link
Contributor

Feature Request

Reuse already created is given as an argument to reduce the code size of is for large interfaces.

Idea

Typia works without this, so I think it acceptable to have strict conditions.

  • If it's not the type you're looking for, ignore it.
  • Ignore variable symbols even if they do not appear.
    ex:) typia.is<User>(), validators.user
  • Ignore any cases beginning with _, $.

Example

import typia from "typia";

interface User {
  name: string;
  homepage: string;
  age: number;
}

interface Comment {
  author: User;
  content: string
}

interface Article {
  author: User;
  content: string;
  comments: Comment[]
}

const isUser = typia.createIs<User>();
const isComment = typia.createIs<Comment>(isUser);
const isArticle = typia.createIs<Article>(isUser, isComment);
@samchon samchon added the duplicate This issue or pull request already exists label Dec 2, 2024
@samchon
Copy link
Owner

samchon commented Dec 2, 2024

I have no idea about this way. Would you challenge about this issue?

@samchon samchon added the help wanted Extra attention is needed label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants