Commit Graph
1624 Commits
Author SHA1 Message Date
Andrew 13d9f08976 Gracefully parse 'super' with type arguments (#10677) (#30913) 2019-04-15 13:06:29 -07:00
Anders Hejlsberg 6cd229b4b9 Merge pull request #30769 from Microsoft/saferIndexedAccessTypes
Improve soundness of indexed access types
2019-04-12 07:33:50 -10:00
Nathan Shively-Sanders ff959096df Fix some bad jsdoc comment indent (#30838)
* First draft

Solves the initial problem but breaks commentCommentParsing. I also
found a couple more interesting cases.

* Add more tests and fix their bugs

* Another test case

* Some cleanup

I may try do a little more; `margin += tag.end - tag.pos` bothers me a
bit.

* More cleanup
2019-04-10 08:22:09 -07:00
Anders Hejlsberg e1fd5e5225 Fix unsafe parameter coercions related to PragmaPseudoMap 2019-04-06 06:29:59 -10:00
Andrew Branch 3f3444be80 Merge pull request #30699 from andrewbranch/bug/30635
Fix ternaries where "true" is a parenthesized variable and "false" is a function expression
2019-04-02 14:03:11 -07:00
Wesley Wigham ca98a50574 Use const contexts and tuple mapped types to simplify some explicitly elucidated types (#30654)
* Use const contexts and tuple mapped types to simplify some explicitly elucidated types

* Fix lint

* Further cleanup - refactor mapped type into its own alias for readability

* Slightly more cleanup - PragmaPsuedoMap neednt be partial, thus removing tons of nonull assertions

* Remove GH#18217 comments
2019-04-02 13:04:51 -07:00
Andrew Branch 96660f6c00 Just look at the current node instead of context 2019-04-02 11:31:05 -07:00
Andrew Branch d198c5906f Be stricter while parsing arrow function heads in conditional expressions 2019-04-02 11:17:21 -07:00
Wenlu Wang b97b1a8de6 add jsx factory and hold text in jsxtext node (#29439)
* add jsx factory and hold text in jsxtext node

* update jsxtext prop name and factory
2019-03-11 16:00:18 -07:00
Sheetal Nandi 9fa28158bb Enable building typescript.d.ts with current source 2019-02-22 18:11:27 -08:00
Anders Hejlsberg 4706a060a5 Merge branch 'master' into readonlyArrayTuple 2019-01-26 14:44:15 -08:00
kingwl e8497096d8 Merge branch 'master' into improve_type_arguments_parser_1 2019-01-20 01:54:49 +08:00
Anders Hejlsberg bb8378fddf Support 'readonly' type modifier on array and tuple types 2019-01-15 09:43:39 -08:00
Wesley Wigham fadd95f72b Fix unneeded cast lints (#29383) 2019-01-11 14:24:49 -08:00
Anders Hejlsberg 92a8cc9f5f Fix logic that bails out of incremental parsing in certain contexts 2018-11-29 10:19:42 -08:00
Klaus Meinhardt 1ad7b0fe69 forEachToken: correctly handle JSDocTag (#28369)
* forEachChild: handle JSDocTags and all their children

* fix codefix for unused identifier

* fix lint

* fix build

* Fix test failures
2018-11-15 13:22:25 -08:00
Andy 772f6cdf48 Remove JSDocTag#atToken (#28376) 2018-11-06 09:54:23 -08:00
Caleb Sander 28e9ec497c Address review comments 2018-11-05 11:36:32 -08:00
Caleb Sander 188c07865a Scan bigint literals 2018-11-05 11:36:31 -08:00
Andy 36dfd775b3 Parse an object literal property as shorthand unless followed by '(' or ':' (#28121) 2018-10-26 15:00:31 -07:00
Andy efc831e0ba At '.' in array literal, don't close the array (#28120) 2018-10-25 12:25:33 -07:00
Andy 54a5be1860 At '.' in object literal, don't close the object (#27850)
* At '.' in object literal, don't close the object

* Include diagnostics test
2018-10-12 08:49:04 -07:00
Andy f6ca10565d Fix bug: Ensure JSDoc type range is valid (#27343) 2018-10-08 17:09:48 -07:00
Andy dd9b8cab34 Have scanJsDocToken scan keywords (#27162)
* Have scanJsDocToken scan keywords

* Update API
2018-10-08 14:42:51 -07:00
Andy deeb40129d Remove duplicate case in parseJsDocCommentWorker (#27164) 2018-10-04 15:44:01 -07:00
Nathan Shively-Sanders 21148b3b0a Fix typo in PseudoPragma* types (#27437) 2018-09-28 10:39:30 -07:00
Andy f71d6005a2 Use nextToken() after parsing a tag name so we can parse type keywords (#26915)
* Use nextToken() after parsing a tag name so we can parse type keywords

* Make callback to skipWhitespaceOrAsterisk non-optional
2018-09-13 15:49:06 -07:00
Andy 2b888c30f9 Consistently pass indent to 'parseTagComments' (#27055)
* Consistently pass indent to 'parseTagComments'

* Update baselines
2018-09-12 17:44:06 -07:00
王文璐 f396a2c7a8 rename rescan function 2018-09-07 11:39:50 +08:00
王文璐 0e97ce57e4 Merge branch 'master' into improve_type_arguments_parser_1 2018-09-07 11:36:02 +08:00
Ryan Cavanaugh 5d65e86756 Merge pull request #23253 from Kingwl/definite-assignment-assertion-improve
improve parser and error message if definite assignment assertions in…
2018-09-05 11:49:13 -07:00
Tim Schaub 262ea5b06e Skip asterisks after newline when parsing JSDoc types (#26528)
* Skip asterisks after newline when parsing JSDoc types

* Single boolean expression

* Test for parsing and printing multiline function signatures with *
2018-09-04 15:41:08 -07:00
Tim Schaub 20a2b0cade Ignore newline and asterisk when parsing JSDoc typedef (#26775) 2018-08-30 10:01:33 -07:00
Andy cff04e6050 Ensure JsonSourceFile has all the non-optional properties of SourceFile (#26162)
* Ensure JsonSourceFile has all the non-optional properties of SourceFile

* Set properties in parseSourceFile
2018-08-28 16:43:14 -07:00
王文璐 78444bb724 improve test case 2018-08-27 11:47:10 +08:00
王文璐 268dbfe093 parse less than token rather than left shift in context of type arguments 2018-08-24 11:00:59 +08:00
Tim Schaub 6fd725f3ea Skip whitespace or asterisk in JSDoc param type and name (#26067) 2018-08-16 16:16:09 -07:00
Andy 08f5edbd03 Treat NoSubstitutionTemplateLiteral like StringLiteral in more places (#26330)
* Treat NoSubstitutionTemplateLiteral like StringLiteral in more places

* Move isStringOrNumericLiteral closer to its only use
2018-08-10 16:00:08 -07:00
Nathan Shively-Sanders a6c5d50749 Allow type predicates in JSDoc (#26343)
* Allow type predicates

1. Parse type predicates. Note that they are parsed everywhere, and get
the appropriate error when used places besides a return type.
2. When creating a type predicate, correctly find the function's parameters
starting from the jsdoc return type.

* Fix type of TypePredicateNode.parent: add JSDocTypeExpression

* Update API baselines

* Handle JSDoc signature inside @type annotations

* Fix circularity when getting type predicates

Also move createTypePredicateFromTypePredicateNode closer to its use

* More cleanup based on review comments
2018-08-10 15:31:39 -07:00
Andy a73161e9d5 Don't store @template constraint in a TypeParameterDeclaration node (#26283)
* Don't store @template constraint in a TypeParameterDeclaration node

* Code review

* Update API
2018-08-09 17:39:15 -07:00
Tim Schaub 960800d1fe Remove trailing whitespace from JSDoc comments 2018-07-28 10:36:10 -06:00
Nathan Shively-Sanders 25fb5419c0 Support the JSDoc @enum tag (#26021)
* Support the JSDoc @enum tag

`@enum` is used on a variable declaration with an object literal
initializer. It does a number of things:

1. The object literal has a closed set of properties, unlike other
object literals in Javascript.
2. The variable's name is resolvable as a type, but it just has the
declared type of the enum tag.
3. Each property's type must be assignable to the enum tag's declared type,
which can be any type.

For example,

```js
/** @enum {string} */
const Target = {
  START: "START",
  END: "END",
  MISTAKE: 0, // error 'number' is not assignable to 'string' -- see (3)
}

Target.THIS_IS_AN_ERROR; // See (1)
/** @type {Target} See (2) */
var target = Target.START;
```

* Fix lint, add new test case, update API baselines
2018-07-28 07:53:08 -07:00
Andy d40d54984e Support deleting all unused type parameters in a list, and deleting @template tag (#25748)
* Support deleting all unused type parameters in a list, and deleting @template tag

* Support type parameter in 'infer'
2018-07-27 11:55:31 -07:00
Andy 5e94cf626b Expand span of @typedef with properties to include the @typedef tag (#25950) 2018-07-26 08:56:24 -07:00
王文璐 c531065fd0 Merge branch 'master' into definite-assignment-assertion-improve 2018-07-26 18:06:47 +08:00
Matt McCutchen f72193eedc Report a semantic error for an arrow function with a "this" parameter.
Fixes #9744.
2018-07-23 10:42:56 -04:00
Nathan Shively-Sanders 1cedab18be Fix parsing of parenthesized JSDoc parameters (#25799)
* Fix parsing of parenthesized JSDoc parameters

Parenthesis can start a jsdoc function parameter since it is just a
type, and parenthesis can start a type:

```js
/** @type {function(((string))): void} */
```

However, this is not legal in other parameter lists:

```ts
function x((((a))): string) { }
```

This change makes jsdoc function parameter lists parse differently than
normal parameter lists by allowing parenthesis as a start character of
jsdoc parameters.

* Parse nested uses of jsdoc function types

* Fix test
2018-07-19 12:50:36 -07:00
Andy 6d8a5f6288 Fix invalid cast: JSDocSignature is not a SignatureDeclaration (#25734) 2018-07-17 13:35:55 -07:00
Andy 64555aa6a9 navigateTo: Collect results from all referenced projects. (#25283)
* navigateTo: Collect results from all referenced projects.

* Don't use project references, just source maps

* Move more code to session

* Test when implementation file is deleted

* Use tsserver tests instead of fourslash tests to ensure session is used

* Support find-all-references

* Restore fourslash tests

* Update emit baselines (added missing newline)

* Support rename

* @weswigham code review

* Don't open/close files

* Avoid growing `toDo` too eagerly

* @sheetalkamat code review

* Also get symlinked projects for originalLocation

* Update API (#24966)

* More @sheetalkamat code review

* Remove unnecessary test

* Update API (#24966)
2018-07-05 15:39:03 -07:00
Andy 76a4694bd4 parser: Fix testing for missing list (#25411)
* parser: Fix testing for missing list

* Fix return type
2018-07-03 12:37:20 -07:00