Skip to content

🍯 Grouping of functions without being a dependency to align with tests describes #60747

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

Closed
6 tasks done
willi84 opened this issue Dec 12, 2024 · 5 comments
Closed
6 tasks done
Labels
Out of Scope This idea sits outside of the TypeScript language design constraints Suggestion An idea for TypeScript

Comments

@willi84
Copy link

willi84 commented Dec 12, 2024

πŸ” Search Terms

group

βœ… Viability Checklist

⭐ Suggestion

(no idea what to be checked in βœ… Viability Checklist)

In Tests I can organize a set of tests with e.g. describe, but in TS (or JS) its just possible, when I create Modules, Classes, Namespaces etc. But this creates dependencies I dont want to have.

The suggestion is a sugar feature, which groups my functions the same like describe does but dont creates depency

group {
   export const makeTooltip()
   export const makeButtons()
}

// but still be callable as

makeTooltip()

πŸ“ƒ Motivating Example

currently u have to organize groups of functions in namespaces or classes

namespace ns {
  export const myFunction1()
  export const myFunction2()
}

// calling
ns.myFunction1()

but it would be better to avoid such dependency but still make functions for the developer organizable

group myCustomgroup {
  export const myFunction1()
  export const myFunction2()
}

// calling
myFunction1()

πŸ’» Use Cases

  1. What do you want to use this for? organizing my code better and aligining it with my tests
  2. What shortcomings exist with current approaches? dependencies or longer callees of functions (foo.bar.lorem.ipsum.myFunction())
  3. What workarounds are you using in the meantime? namespace or class e.g.
@JoostK
Copy link
Contributor

JoostK commented Dec 12, 2024

You're looking for #11073, which might already be achievable with plugins depending on the IDE you're using.

@jcalz
Copy link
Contributor

jcalz commented Dec 12, 2024

no idea what to be checked in βœ… Viability Checklist

Well, you checked "This isn't a runtime feature", but it is a runtime feature. This is something that would have to exist in JavaScript (Stage 3 of the TC39 Process) before TypeScript would implement it. You could try to go through the TC39 process, but I doubt this would ever be accepted. It's the same as the deprecated with statement, or the unsupported import * from 'module'.

@willi84
Copy link
Author

willi84 commented Dec 12, 2024

@jcalz thats the reason why I was honest, I just checked to submit but was not sure where to put the right checkboxes

@willi84
Copy link
Author

willi84 commented Dec 12, 2024

@JoostK thanks :-)

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Out of Scope This idea sits outside of the TypeScript language design constraints labels Dec 12, 2024
@typescript-bot
Copy link
Collaborator

This issue has been marked as "Out of Scope" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Out of Scope This idea sits outside of the TypeScript language design constraints Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants