Commit graph

3 commits

Author SHA1 Message Date
Nathan Shively-Sanders ea8ccc2ce4
In JS, constructor functions infer from call+construct (#28353)
* constructor functions infer from call+construct

Also fix an incorrect combining of inferences for rest parameters: the
inferred types will be arrays in the body of the function and the
arguments from outside the function will be the element type.

* All functions infer from call+construct contexts
2018-11-16 09:51:07 -08:00
Andy 24842b4002
When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors (#22361)
* When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors

* Improve performance: do not add unused suggestion diagnostics unless asking for a suggestion

* Add "unused" flag to diagnostics

* Code review

* reportsUnused -> reportsUnnecessary

* Fix test
2018-04-05 12:33:00 -07:00
Mohamed Hegazy 4487917f89 Quick fix for no-implicit-any errors to add explicit type annotation (#14786)
* Infer from usage quick fix

* Change full function singature

* Add property/element access support

* Fix a few issues

* Some cleanup

* Expose getArrayType and getPromiseType

* Switch to collecting all usage before infering

* Infer array and promise type arguments

* Handel enums in binary operators

* consolidate usage of addCandidateTypes

* Handel rest paramters

* Properly handel `+=` and `+` inference for numbers and strings

* Add print quickfixes debug helper

* Add rest param tests

* Add optional paramter tests

* Handel set accessors

* Support getters

* Support no implicit any error for variable at use site

* Support properties

* Only offer quick fix if an infered type other than any is available

* Rename functions

* Move to a separate namespace

* Check cancellation token

* Cleanup

* Check for accesibile symbols where serializing types

* Remove JS support

* Reorganize functions

* Mark APIs as internal

* Fix lint errors

* Removed conflict markers.

* Update 'createSymbol' to use '__String'.

* Fixed most problems relating to '__String' and 'includeJsDocComments' in the fix itself.

* Addressed most API changes.

* Make all helpers internal

* Use a diffrent writer and not the built-in single line write

* Infer types for all parameters in a parameter list instead of one at a time

* Accept baselines

* Code review commments

* Respond to code review comments
2017-10-12 10:14:58 -07:00