Commit Graph
245 Commits
Author SHA1 Message Date
Andy b3edc8f9f4 Apply 'no-unnecessary-type-assertion' lint rule (#22005)
* Apply 'no-unnecessary-type-assertion' lint rule

* Fix type error

* Fix tsconfig.json

* Add --format back
2018-02-16 18:38:00 -08:00
Anders Hejlsberg a629acd8fd Allow +/- to prefix 'readonly' and '?' modifiers in mapped types 2018-02-12 16:20:49 -08:00
Anders Hejlsberg 7034d671db Merge branch 'conditionalTypes' into inferTypes 2018-02-03 08:41:54 -08:00
Anders Hejlsberg d4dc67aab2 Merge branch 'master' into conditionalTypes
# Conflicts:
#	src/compiler/checker.ts
2018-02-03 07:26:38 -08:00
Wesley Wigham a33dae3771 Rework how default vs local name selection is done to be more correct (#21526) 2018-02-01 12:34:25 -08:00
Anders Hejlsberg 7c241ba2f7 Merge branch 'conditionalTypes' into inferTypes
# Conflicts:
#	src/compiler/checker.ts
#	tests/cases/fourslash/completionInJSDocFunctionNew.ts
#	tests/cases/fourslash/completionInJSDocFunctionThis.ts
2018-01-30 13:40:16 -08:00
Anders Hejlsberg 4f2b5f32f9 Merge branch 'master' into conditionalTypes 2018-01-30 06:42:14 -08:00
Anders Hejlsberg 60c9249ac4 Properly handle inferred type parameters in declaration emitter 2018-01-26 06:20:39 -08:00
Anders Hejlsberg d608941480 Implement type inference in conditional types 2018-01-25 12:25:00 -08:00
Sheetal Nandi ed23ca582a Merge branch 'master' into builderApi 2018-01-17 16:11:44 -08:00
Anders Hejlsberg 4ec6fdd96f Merge branch 'master' into conditionalTypes
# Conflicts:
#	src/compiler/checker.ts
#	src/compiler/types.ts
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2018-01-17 13:12:36 -08:00
Wesley Wigham 154c6141f1 Allow functions to be printed structurally in declaration emit even when they have symbols (#21203)
* Allow functions to be printed structurally in declaration emit even when they have symbols

* Implement CR feedback and fix lint
2018-01-16 12:37:15 -08:00
Sheetal Nandi 5bd3f97b18 Merge branch 'master' into builderApi 2018-01-16 11:14:39 -08:00
Wesley Wigham 76d9524866 Fully deprecate the symbol display builder, reimplement in terms of node builder (#18860)
* Remove SymbolWriter, give methods to EmitTextWriter

* Unification of writers is done-ish

* Make node builder support more flags

* Write out mixins like we used to

* Accept prototype-free baselines

* Use instantiated constraint when building mapped type nodes

* Accept better mapped type baselines

* Report inaccessible this in node builder

* Turns out there was a bug in our codefix, too

* Symbol display builder usage falling

* Replace signatureToString with a nodeBuilder solution

* Replace the last internal usages of the symbol writer

* Accept semicolon additions

* Accept updated symbol baseline output

* Start using node builder for some LS operations

* Remove those pesky trailing semicolons on signatures

* Get signature printing much closer to old output

* Parameter lists should not be indented by default, especially when single-line

* Signatures up to snuff

* Type quickinfo emit is up to snuff

* Start of symbol writer replacement, needs a bit more for full compat

* Slightly mor accurate to old behavior

* Replicate qualified name type argument output correctly

* Bring back the old symbol baselines

* Mostly identical to old symbol emit now

* Perfectly matches old behavior thus far

* Replace another usage of the symbol builder

* Another usage removed

* Another usage removed

* Remove final uses of symbol display builder

* Remove implementation and types for unused symbol display builder

* Cleanup in the checker

* monomorphize new emitter code

* Replace emitWithSuffix

* Push space character to interface with writer

* List emit

* Fix lack of usage of emitExpression

* writeList, not printList

* Remove listy writes and replace with new printer calls

* Move ListFormat into types.ts

* Remove most new XToString functions in favor of node builder functions

* Accept API breaks

* Add getSymbolDisplayBuilder polyfill

* Accept updated API baseline

* Move definition to make diff easier to read

* Reinternalize some things

* Remove trailign whitespace

* Reorder for zero diff

* Remove newline

* Make shim mor eperfectly imitate old behavior

* Style feedback

* Rename reset to clear to maintain backcompat with SymbolWriter

* Fix quickfix

* Keep EmitTextWriter internal

* Remove EmitTextWriter from public API

* Mimic default name declaration emit fix

* Fix tests broken by merge

* use isFunctionLike

* Cleanup, sync TypeFormat and NodeBuilder flags

* Reorder Node initialization so pos and end are first, so a TextRange hidden class is made first to reduce future polymorphism

* Use variable instead of ternary

* Write helper for emitNodeWithWriter

* Emitter cleanup

* Cleanup whitespace, comment

* Reuse printer

* Raise error if display parts writer uses rawWrite

* Hide writer parameter through different function instead of overload, rename function in emitter

* Make less printer

* fix lint
2018-01-16 09:53:42 -08:00
Anders Hejlsberg 5094f7677c Remove 'T extends U' type constructor 2018-01-15 08:11:05 -08:00
Anders Hejlsberg 53b1572ed6 Revert to extends check being part of conditional type 2018-01-15 07:59:46 -08:00
Wesley Wigham b1a0261575 If declaration emit input is a module, output should be a module (#20626) 2018-01-08 13:58:34 -08:00
Sheetal Nandi 5bc78afcbb Merge branch 'master' into builderApi 2018-01-08 13:01:09 -08:00
Andy 6f2ba15446 Start linting for double spaces (#20820)
* Start linting for double spaces

* Code review

* Fix cases that were excluded by countDoubleSpaces

* Remove extraneous closing parenthesis
2018-01-08 08:52:13 -08:00
Anders Hejlsberg abc8110e9b Merge branch 'master' into conditionalTypes
# Conflicts:
#	src/compiler/checker.ts
2018-01-03 10:56:45 -08:00
Wesley Wigham dd933f4413 Fix get symbol at location to behave correctly for parameter assignments and jsx attributes (#20706)
* Fix get symbol at location to behave correctly got parameter assignments and jsx attributes

* Handle all those edge cases that weren;t explicitly handled

* Fix part of bug WRT getTypeAtLocation and for loops

* Baseline corrections pursuant to #20710

* Restore jsdoc tag interpretation

* Clean up some code, revert fourslash tests

* Cleanup types used by PR feedback
2017-12-15 15:50:22 -08:00
Anders Hejlsberg ec2bdfdb8b Add 'T extends U' type operator 2017-12-12 09:52:14 -08:00
Anders Hejlsberg 57ca7680c9 Initial implementation of conditional type operator 2017-12-05 14:18:11 -08:00
Sheetal Nandi 0b79f4a073 Handle emit only declaration file to always produce declaration file and skip the diagnostics check 2017-11-22 18:37:07 -08:00
Wesley Wigham 50866e114a Fix visibility checking of mutually recursive exports (#19929)
* Do visibility painting from collectLinkedAliases in checker to remove statefullness in declaration emit

* Fix #17085

* Add deeply destructured array to test

* Add test case for #18634

* Add PR feedback
2017-11-21 15:06:27 -08:00
Ron Buckton 804c7d3690 Merge branch 'master' into dynamicNames 2017-11-13 13:24:20 -08:00
Ron Buckton ae11ae55c5 Fix getReturnTypeFromBody widening 2017-11-13 13:19:49 -08:00
Adrian Leonhard a1da5bd5af Changed error for setter when emitting declaration with private param type (#18593)
so that error message refers to prop name instead of param name.

Changed getter errors for similar case so they also refer to prop name.

Fixed bug where static getters wouldn't output their specific error.

Fixes #1976
2017-11-08 10:02:39 -08:00
Ron Buckton 44117e19ea Reduce noise in PR, minor cleanup 2017-10-26 17:57:54 -07:00
Ron Buckton 170e6ec130 Ensure correct errors when emitting declarations 2017-10-26 15:50:07 -07:00
Ron Buckton 51929acb89 Merge branch 'master' into dynamicNames 2017-10-21 00:36:52 -07:00
Sheetal Nandi e30a66d22f Add utitlity for stringContains 2017-10-10 17:16:39 -07:00
Ron Buckton ee23f93275 Switch to 'unique symbol' 2017-10-04 19:34:29 -07:00
Ron Buckton 891e71d44f Remove freshness, more comprehensive grammar checks and diagnostic messages 2017-09-22 15:08:55 -07:00
Ron Buckton d7ef99523d Merge branch 'master' into dynamicNames 2017-09-21 12:48:51 -07:00
Andy e2141ad469 Mark some arrays as readonly (#17725)
* Mark some arrays as readonly

* Avoid unnecessary allocations and style changes

* Fix lint
2017-08-24 09:55:01 -07:00
Andy 7409648416 Remove unused UseTypeAliasValue flag (#17779) 2017-08-15 10:24:15 -07:00
Yui 39e0cc61a7 Fix 16628: "undefined" exception when name of binding element in binding pattern is empty (#17132)
* Handle the case where binding pattern name element is empty

* Update tests and baselines

* Feedback from PR

* Handle empty binding patterns more generally in emitter

* Dont simply handling fo empty binding patterns and stay spec compliant

* PR feedback
2017-08-09 13:47:44 -07:00
Andy eadd084c82 Add 'name' property to Identifier (#17329)
* Add 'name' property to Identifier

* Rename to unescapedText

* Rename 'id.text' to 'id.escapedText'

* Rename 'id.unescapedText' to 'id.text'

* Make escapeIdentifier and unescapeIdentifier do nothing
2017-07-25 13:16:34 -07:00
Andy 194c2bc2ca Make NodeArray readonly (#17213)
* Make NodeArray readonly

* Fix bug: use emptyArray instead of undefined

* Fix bug: Don't expose MutableNodeArray

* Undo trailing whitespace changes
2017-07-18 10:38:21 -07:00
Nathan Shively-Sanders 433a06d599 Add isOptionalUninitializedParameterProperty
Improves declaration emit and code readability
2017-06-13 11:49:58 -07:00
Nathan Shively-Sanders 2a921d4b33 Use checker for decl emit:optional parameter props
Optional parameter properties create a property with a type that unions
with undefined when strictNullChecks is on. This needs to be reflected
in the generated declaration.
2017-06-13 11:31:51 -07:00
Ron Buckton 022e81b848 Merge branch 'master' into dynamicNames 2017-06-09 14:58:41 -07:00
Andy 0d36d0e39f Support completions for qualified names in JSDoc (#16380)
* Support completions for qualified names in JSDoc

* Fix typo
2017-06-08 17:21:36 -07:00
Ron Buckton 625b37e7b4 Merge branch 'master' into dynamicNames 2017-05-30 17:11:48 -07:00
Nathan Shively-Sanders bc914c02e6 Merge pull request #15932 from Microsoft/decl-emit-class-expr-as-type-literal
Declaration-emit class expressions as type literals
2017-05-22 15:46:38 -07:00
Nathan Shively-Sanders 860e8e88c8 Add error for class exprs w/private properties 2017-05-22 14:49:35 -07:00
Nathan Shively-Sanders a0fa8ae6c4 Address most PR comments
I am still working on the error for class expressions that extend from a
non-exported base.
2017-05-22 10:18:31 -07:00
Anders Hejlsberg 947abf5d6b Merge branch 'master' into literalEnumTypes
# Conflicts:
#	src/compiler/checker.ts
#	src/compiler/diagnosticMessages.json
#	src/compiler/types.ts
#	src/compiler/utilities.ts
#	src/services/completions.ts
2017-05-17 11:59:12 -07:00
Andy Hanson 0ff187c8ac Remove 'isDeclarationFile()' function, use '.isDeclarationFile' 2017-05-17 08:12:23 -07:00