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

fix: add NoInfer to IntrinsicNodeParser #2133

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

EladBezalel
Copy link

fixes #2132

@@ -12,6 +12,7 @@ export const intrinsicMethods: Record<string, ((v: string) => string) | undefine
Lowercase: (v) => v.toLowerCase(),
Capitalize: (v) => v[0].toUpperCase() + v.slice(1),
Uncapitalize: (v) => v[0].toLowerCase() + v.slice(1),
NoInfer: (v) => v,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests?

@arthurfiorette arthurfiorette self-assigned this Dec 13, 2024
@EladBezalel
Copy link
Author

Ah totally missed that the tests are in a separate folder, I'll look at it

@@ -4,11 +4,13 @@ type ResultUpper = Uppercase<Result>;
type ResultLower = Lowercase<ResultUpper>;
type ResultCapitalize = Capitalize<Result>;
type ResultUncapitalize = Uncapitalize<ResultCapitalize>;
type ResultNoInfer = NoInfer<Result>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure this isn't how NoInfer is intended to be used and is a flaky test since all other intrinsic types are string-dependent and NoInfer might not be.

Please create a separate test with a code like:

// (I wrote this out of my head)

function test<T>(value: NoInfer<T>): T { return value } 
// create a function with type constraints as well (test<T extends something>())

export const MyObject = {
  str: test('asd'),
  // more samples with objects, type references, and so on...
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but thanks for working in this <3

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

Successfully merging this pull request may close these issues.

Unknown intrinsic method: NoInfer
2 participants