Commit graph

133 commits

Author SHA1 Message Date
Wesley Wigham 3ea81e652a
Ensure whitespace jsx elements are not counted when determining if a jsx child is the only child (#40839)
* Ensure whitespace jsx elements are not counted when determining if a jsx child is the only child

* Use filtered children count for deciding constructor used

* Accept updated baselines post-merge
2020-10-01 14:36:44 -07:00
Hikari Hayashi f1ac8cd93f
Fix children prop for react-jsx and react-jsxdev (#40630)
* Fix children prop for `react-jsx` and `react-jsxdev`

* Add tests
2020-09-18 14:26:20 -07:00
Wesley Wigham a36f17c1f8
Add emit support for jsx/jsxs experimental jsx runtime api (#39199) 2020-09-11 10:44:52 -07:00
Noj Vek f697d26ca1
reset soft with master for single commit (#38720) 2020-06-18 00:22:32 -07:00
Jack Works 8e290e5aae
Improve error range for ts2657 (jsx expr must have parent element), add code fix for it (#37917)
* fix: range of ts2657 (jsx expr must have parent) and remove 2695 (LHS expr of comma has no side effects)

* feat: add code fix for 2657

* fix: resolve review

* chore: hoist a var

* chore: add test for skipTrivia

* fix: rebase error

* Update src/compiler/diagnosticMessages.json

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

* Update src/services/codefixes/wrapJsxInFragment.ts

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

Co-authored-by: Andrew Branch <andrew@wheream.io>
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-06-01 12:22:44 -07:00
Alexander T 696413749b
fix(37456): add tests for JsxOpeningElement nodes (#37752) 2020-04-02 10:38:31 -07:00
Alexander T c546988e50
fix(37456): omit type arguments from JsxSelfClosingElement, JsxOpeningElement nodes (#37739) 2020-04-01 16:27:33 -07:00
Alexander T f1eb9898fb
feat(36908): add 'property overwritten by spread' error for jsx attributes. add related span for conflicting declaration in spread (#37329) 2020-03-17 13:13:38 -07:00
Nathan Shively-Sanders a772c26a71
Error when property is specified more than once via a spread (#36727)
* add tests but not baselines or fixes

* Update original change

Still probably wrong; probably doesn't even compile beacuse I'm just
typing on my laptop.

* fix error code ok

* notes to self

* Error: property is specified more than once via spread

* make jsx tests stricter

* update semicolon error message

* use ?. because it is great

* use maybeTypeOfKind in new code

* restore jsx error

* add tests
2020-02-11 10:23:15 -08:00
Brad Zacher 348c4dddc6
Throw syntax error for } and > in JSX text (#36636)
* Throw syntax error for `}` and `>` in JSX text

Fixes #36341

* Add codefix for error
2020-02-11 11:44:17 -05:00
Hye Sung Jung 8ed129771f
fix spelling errors (#36523)
* fix spelling errors

* remove changes in lib/*
2020-01-30 13:39:54 -08:00
Ron Buckton 2eb60c2cb2
Fix decoding of HTML entities in TSX/JSX (#35739) 2019-12-17 17:32:48 -08:00
Wesley Wigham f333684179
Fix unicode escapes in jsx identifiers and extended unicode characters in jsdoc (#32716)
* Fix unicode escapes in jsx identifiers and extended unicode characters in jsdoc

* Support unicode escapes in JSDoc

* Add tests for extended escapes
2019-08-06 15:14:32 -07:00
Wesley Wigham 41a7bf4b73
Fake up value declaration for synthetic jsx children symbol so they get excess property checked (#29359) 2019-01-15 22:31:57 -08:00
Wesley Wigham 0c36266706
Obey the excludeArgument parameter when checking JSX signature validity (#28002)
* Obey the excludeArgument parameter when checking JSX signature validity

* Fix conditional type extending any contextual types and accept baselines

* use flag check to also drop unknown from comparison for the same reason

* Slight refinement - make an intersection to ensure parameter constraints flow through contextual types when instantiated

* Format ternary more nicely
2018-10-22 16:36:11 -07:00
Wesley Wigham f701daf4e0
Infer over each mapped type constraint member if it is a union (#28006) 2018-10-22 16:33:43 -07:00
Wesley Wigham 7b5ef64e76
Unify JSX And Normal Call Checking Codepaths (#27627)
* Unify JSX Call Checking Codepaths

* Add tests for fixed issues

* Fix lint, move all error checking into the only-run-once resolveSignature call

* Remove unused (unreachable?) code path

* Consolidate a little more duplicated logic into signature checking

* Fix #19775 a bit more

* Cosmetic changes from CR
2018-10-16 20:16:00 -04:00
Wesley Wigham 07dbd8be21
Discriminate jsx contextual types same as object contextual types (#27408)
* Discriminate jsx contextual types same as object contextual types

* Extract core discrimination algorithm to getDiscriminationResultForProperty

* Merge all discrimination implementations

* Fix lints
2018-10-05 15:11:12 -07:00
Wesley Wigham e1d346ea53
Infer tuples for jsx children if contextually typed by a tuple (#27409) 2018-10-04 17:56:38 -07:00
Wesley Wigham 18e3f487a4
Support LibraryManagedAttributes<TComponent, TAttributes> JSX namespace type (#24422)
* WIP

* Allow type alias for managed type

* Add a large test

* Accept updatedbaselines

* Fix typo in test, add one more example
2018-06-29 18:45:29 -07:00
Nathan Shively-Sanders 15bfaf1cf6
Skip IntrinsicAttributes elaboration in JSX errors (#24461)
* Skip IntrinsicAttributes elaboration in JSX errors

Do not issue an error message for a source type that comes from JSX
attributes and a target type that is an intersection containing
IntrinsicAttributes or IntrinsicClassAttributes. This will make error
messages simpler and less confusing.

Note:
1. There will always be elaboration under the skipped message, so this
won't elide errors completely.
2. Rarely (once in the tests) the intersection type will have more that
one non-Intrinsic* member. However, these additional members don't
provide useful information either, so it's fine to skip them.

* Add test of IntrinsicAttributes error

* Fix indentation in test
2018-05-29 14:00:26 -07:00
Wesley Wigham a909000b62
Parse and check type arguments on JSX opening and self-closing tags (#22415)
* Parse and check type arguments on JSX opening like elements

* Fix nits
2018-03-22 15:07:36 -07:00
Benjamin Lichtman dfa1a90b25
Merge pull request #22135 from uniqueiniquity/jsxFragmentHash
Allow characters in JsxText inside JsxFragment that usually don't scan
2018-03-01 16:50:09 -08:00
Wesley Wigham 1a43ad01a7
Lookup JSX namespace within factory function (#22207)
* Lookup JSX namespace within factory function

* Rename functions
2018-02-28 15:48:33 -08:00
Wesley Wigham 32c63a2628
Add support for transpiling per-file jsx pragmas (#21218)
* Add support for per-file jsx pragmas

* Add error for using jsx factory pragma with fragments

* More tests, use different regex class for pragma capture

* Unify all pragma parsing machinery
2018-02-26 16:10:00 -08:00
uniqueiniquity 71ff6dd91e Allow characters in JsxText inside JsxFragment that would not normally scan 2018-02-22 15:56:34 -08:00
Wesley Wigham 17554ff285
Fix JSX contextual types to not eagerly become apparent, use 2-pass inference for JSX (#21383)
* Fix JSX contextual types to not eagerly become apparent

* Apply changes from code review, unify common code

* Fix jsx children contextual typing

* Light code review feedback

* Use fillMissingTypeArguments

* Accept nonliteral jsx child type

* Add test for the fillMissingTypeArguments case
2018-02-05 16:33:39 -08:00
Nathan Shively-Sanders ae652404cd Fix JSX attribute checking when spreading unions
Previously, the code didn't account for the fact that spreading a union
creates a union. In fact, before Decemeber, spreading a union in JSX
didn't create a union.

Now the check for properties of the spread type uses
`getPropertiesOfType`, which works with unions, instead of accessing the
`properties` property directly.
2018-01-22 13:34:12 -08:00
Wesley Wigham e0f20334d2
Use inference for filling JSX attributes in getJsxElementInstanceType (#20973)
* Add simple type inference for JSX elements

* Small cleanups from PR feedback
2018-01-03 11:30:41 -08:00
Wesley Wigham ae73a9141d
Allow JSXAttributes types to be shortcut-spread into the spread type like normal objects (#19047)
* Bring jsx type resolution inline with normal objects, move jsx attribute property ignorign into relationship check

* Improved errors and reordered members

* Always use inferrential mode for jsx pass

* Add some missing skipLibChecks

* New check mode instead of odd type mapper

* Do not enable object literal freshness checks on jsx spreads

* Fix minor style nits

* Update order of type for test

* Accept corrected baseline
2017-12-15 16:13:28 -08:00
Wesley Wigham a1669bb431
handle multiline jsx strings correctly, emit escapes in jsx attributes correctly (#20309) 2017-11-29 17:08:51 -08:00
uniqueiniquity 5f8a1b5b56 Add baselines 2017-10-17 09:38:23 -07:00
uniqueiniquity 269d37a2e6 Update tests 2017-10-17 09:38:22 -07:00
Wesley Wigham 648bd6e9e0 Skip more lib checks, improve test execution time a bit more (#18952)
* Skip more lib checks, improve test execution time a bit more

* Change complexRecursiveCollections to still check

* Remove way more
2017-10-04 14:43:35 -07:00
Wesley Wigham 25c3b99f29 Add skip lib check to many tests (#18935)
* Add skip lib check to many tests, do not include unit test duration in profiler duration

* Add a few more skipLibCheck flags

* A few more

* Add more skip lib check flags
2017-10-04 13:14:05 -07:00
Nathan Shively-Sanders a5b68c0800 Update tests and baselines 2017-06-08 09:07:16 -07:00
Nathan Shively-Sanders 463e385db6 Fix react tests w/incorrect weak type assignments
This even includes react.d.ts itself!
2017-05-24 12:48:13 -07:00
Yui 1c3cdf11b5 Fix the issue 15232 (#16004) 2017-05-23 10:26:07 -07:00
Mohamed Hegazy d51e467238 Fix #15463: use intersection types to emulate spread in generic react components (#15851)
* Fix #15463: use intersection types to emulate spread in generic react components

* Fix lint errors

* reverse condition
2017-05-15 15:46:50 -07:00
Yui T 8d09085800 Add more tests and update baselines 2017-05-11 22:40:34 -07:00
Kanchalai Tanglertsampan bce7ddb5c5 Add tests and update lib tests file 2017-05-11 16:30:56 -07:00
Kanchalai Tanglertsampan d17450bbbd Update tests and baselines 2017-05-08 13:35:09 -07:00
Yui T d94d490647 Updates tests and baselines 2017-05-05 10:05:50 -07:00
Yui T 5b972b44ff Add tests and baselines 2017-05-05 08:47:52 -07:00
Kanchalai Tanglertsampan d103504ba6 Update tests anad baselines 2017-05-04 17:12:52 -07:00
Kanchalai Tanglertsampan b1cfee2070 Add tests and baselines 2017-05-03 15:15:51 -07:00
Yui T f3a3198bec Add tests and update baselines 2017-05-03 13:42:48 -07:00
Kanchalai Tanglertsampan 9a23b75f05 Update baselines and tests (2) 2017-04-17 13:00:38 -07:00
Kanchalai Tanglertsampan dbf2a96a7e Update tests and baselines 2017-04-14 15:23:48 -07:00
Kanchalai Tanglertsampan 58e2189f45 Add tests and update baselines 2017-04-12 13:38:11 -07:00