microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.21k stars 12.51k forks source link

I very much hope that ts will provide any as an implicit type, thank you #60536

Closed 1057105012 closed 2 days ago

1057105012 commented 5 days ago

πŸ” Search Terms

When writing ts, sometimes the type must be given, such as lambda. If you don’t want to write it, you must also give it: any. One is fine, but if there are many, the mental burden is very heavy

I want any to be the default type. If the function parameter type, function return value type, and variable type are not specified, the default type will be automatically deduced to any instead of reporting an error.

For asynchronous functions, the return value is allowed to be declared as a basic type and automatically inferred as a Promise, and defaults are also allowed.

The main purpose is to natively support js syntax in ts. Make ts an add-on rather than a coercion

----- Other suggestions ------ The second problem is that the official documentation of typescript is best to set all the type gymnastics as advanced tutorials and the basic type system as basic tutorials. For most scenarios, we only need type inference of ts, and do not need so many type gymnastics. Moreover, some type gymnastics can be realized through some basic type combinations. this will be complicated

βœ… Viability Checklist

⭐ Suggestion

ζ— 

πŸ“ƒ Motivating Example

ζ— 

πŸ’» Use Cases

  1. What do you want to use this for?
  2. What shortcomings exist with current approaches?
  3. What workarounds are you using in the meantime?
jcalz commented 5 days ago

You didn't fill out the full template.

This already happens if you disable --noImplicitAny, right? Does that not suffice?

nmain commented 5 days ago

It's hard to say because you didn't provide specific code examples as requested by the issue template, but you might also want noEmitOnError: false.

typescript-bot commented 2 days ago

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