Commit graph

1963 commits

Author SHA1 Message Date
Orta Therox 32168ed653
Add support for raising if you set a tsconfig entry of target/module with the right setting in the root (#44964)
* Add support for raising if you set a tsconfig entry of target/module with the right setting in the root

* Switch to check for any compiler option in the root which doesn't include compilerOptions

* Get green

* Apply suggestions from code review

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

* Update src/compiler/commandLineParser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-09-08 10:17:43 +01:00
Orta Therox f9a3d85b00
Fix the default text for --useDefineForClassFields (#45513)
* Fix the default text for --useDefineForClassFields

* Update with feedback
2021-09-01 15:10:47 +01:00
Orta Therox 41dcad056a
Adds a script for removing unused diagnostics (#44324)
* Adds a script for removing unused diagnostics

* Accidentally deleted the wrong one
2021-08-24 13:03:18 +01:00
Gabriela Araujo Britto 84b057828e
Fix incorrect suggestion for package that bundles types (#45507)
* Fix incorrect suggestion for package that bundles types

* determine if a package ships types from its files

* update new error message
2021-08-20 11:12:34 -07:00
Nathan Shively-Sanders 8d4fe5a0fb
Fix unassignable properties by adding undefined with exactOptionalPropertyTypes (#45032)
* Simple first version

Doesn't cover or test any complicated variations.

* Lots of cases work

Destructuring does not. But

- skipping node_modules and lib.* does.
- call expressions does
- property access, including with private identifiers, does

* Support variable declarations, property assignments, destructuring

As long as it's not nested

* More cleanup

* skip all d.ts, not just node_modules/lib

* Offer a codefix for a lot more cases

* remove incorrect tuple check

* Use getSymbolId instead of converting to string

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

* add test + switch to tracking number symbol ids

* Address PR comments

* Exclude tuples from suggestion

* Better way to get error node

Plus add a check that errorNode is an argument to the call, not the
call's expression.

* fix semicolon lint

* fix another crash

* Simplify: add undefined to all optional propertie

whether or not somebody tried to assign undefined to them in the
erroneous assignment

* remove fix-all

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2021-08-10 16:57:38 -07:00
Henrique Inonhe 7753efae79
Improve error message TS1210 (#44892) 2021-08-06 15:00:26 -07:00
Oleksandr T cce2e926de
feat(45163): add QF to declare missing jsx attributes (#45179) 2021-08-06 12:38:22 -07:00
Orta Therox 1f85123821
Revisions for the new --help (#44800)
* WIP on refining the new --help

* Fix types in the boolean trivial lint rule

* Update baselines

* More work

* Updates the color logic

* Simplifies the CLI color code

* Use cyan instead of blue for win powershell/command prompt

* Use bright white when blue is probably going to look off

* Fix NO_COLOR

* Adds a test to cover NO_COLOR

* Update src/compiler/diagnosticMessages.json

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Update compiler diagnostic text

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-08-05 16:41:01 +01:00
Gabriela Araujo Britto 366e9de264
Fix compiler crash on property symbols without declarations (#45190)
* don't track computed name if symbol has no declaration

* add compiler test

* add non serializable property declaration emit error

* don't track computed name if symbol has no declaration

* fix small stuff

* rebase: add non serializable property declaration emit error

* use symbolToString instead of symbolName
2021-07-29 12:42:54 -07:00
Oleksandr T 1aac3555f7
fix(45049): fix diagnostic for missing property initializer (#45052) 2021-07-16 15:10:42 -07:00
Josh Goldberg 541e553163
Specific diagnostic suggestions for unexpected keyword or identifier (#43005)
Error message improvement for unexpected tokens in the following situations:

* A word was parsed that seems to have a low edit distance from a known common keyword
* A word was parsed that seems to be a known common keyword and a name _without_ a space in-between
* Parsing in a particular type of node (mostly a class property declaration) got a different word or token than expected

___

* Specific diagnostic suggestions for unexpected keywords or identifier

* Don't reach into there, that's not allowed

* Improved error when there is already an initializer

* Specific module error message for invalid template literal strings

* Skip 'unexpected keyword or identifier' diagnostics for declare nodes

* Improve error for function calls in type positions

* Switch class properties to old diagnostic

* Corrected errors in class members and reused existing textToKeywordObj map

* Corrected more baselines from the merge

* Update src/compiler/parser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Mostly addressed feedback

* Clarified function call type message

* Split up and clarified parsing vs error functions

* Swap interface name complaints back, and skip new errors on unknown (invalid) tokens

* Used tokenToString, not a raw semicolon

* Inline getExpressionText helper

* Remove remarks in src/compiler/parser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-07-14 13:50:55 -07:00
Ron Buckton 66c3063b06
Add collision check for 'Reflect' when using super in static initializers (#44876)
* Add collision check for 'Reflect' when using super in static initializers

* PR feedback

* Accept baseline for new failing test
2021-07-10 12:48:54 -07:00
Wenlu Wang dc237b317e
Change static fields emits (#43114)
* use emit into iife

* Update emit

* Revert un-related changes

* Allow super in static context

* Allow this and super in static property declaration

* Add more tests

* Avoid errors

* Accept baseline

* Accept baseline

* Add decorated classes test

* Add errors

* Avoid this in emitter

* make lint happy

* Add class expression tests

* Add computed name test

* Avoid super if target below es6

* Adjust function boundary

* Add internal

* Fix minor CR issues

* accept baseline

* Update behavior

* Avoid spaces

* Make lint happy

* Avoid function boundary utils

* Update baseline

* Avoid errors

* Accept baseline

* Accept baseline

* Accept baseline

* Accept baseline

* Use substitutions

* Full coverage for super, this, merge static and private context

* Fix use-before-def in static fields

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 15:49:27 -07:00
Wenlu Wang 906cbd2715
Proposal class static block support (#43370)
* Class static block (#9)

* Add types factory and parser

* Add some case

* Make class static block as a container

* Update cases

* Add visitor

* Add emitter and more compile target

* Check boundary of break and continue

* Add basic transformer

* Fix emit behavior

* Add more tests

* Add friend tests

* Update baseline

* Fix cr issues

* Accept baseline

* Add decorator and modifier check

* Add functional boundary check

* Fix conflict

* Fix computed prop name within context

* Add more tests

* Update baseline

* Avoid invalid test baseline

* Support use before initialize check

* wip

* Fix class static block context

* Fix checks

* Fix missing case

* Improve assert message

* Accept baseline

* Avoid new context

* Update diagnostic message

* Fix name collision

* Fix targets

* Avoid unnecessary files

* Add more case

* Add more test cases

* Fix strict mode function declaration

* Avoid private fields initializer if no private identifier references

* Avoid private fields and add more test case

* Add more case

* Add tests and support for related services functionality

* Fix this reference in static block

* Split parser diagnostic and binder diagnostic

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 09:24:05 -07:00
exoticknight 9708022537
Fix 'arguments' check in class field initializer or static initialization block (#44393)
* Fix 'arguments' check in class field initializer or static initialization block

* return errorType

* Merge branch 'master' of https://github.com/exoticknight/TypeScript

* use isInPropertyInitializer

fix Diagnostics message
2021-06-21 16:57:48 -07:00
Anders Hejlsberg 0e905be42b
Index signatures for symbols and template literal strings (#44512)
* Switch index signature storage to 'indexInfos: IndexInfo[]' property

* Accept new baselines

* Remove another usage of IndexKind enum

* Update getIndexedAccessType and resolveMappedTypeMembers

* Accept new baselines

* Update grammar checking for index signatures

* Accept new baselines

* Consider all index signatures in mapped types and union types

* Accept new baselines

* Update getIndexType

* Accept new baselines

* Intersect multiple applicable index signatures

* Use getApplicableIndexInfo instead of hardwired string/number handling

* Update index signature relationship checking

* Report type for which index signature is missing

* Report type for which index signature is missing

* Accept new baselines

* Make 'number' index signatures consistently apply to numeric strings

* Accept new baselines

* Update fourslash test

* Revise index constraint checking

* Accept new baselines

* Update error messages

* Accept new baselines

* Update type inference from index signatures

* Update isKnownProperty

* Update contextual typing based on index signatures

* Accept new baselines

* Support union types in index signature declarations

* Accept new baselines

* Check duplicate index signatures / remove redundant template literals from unions with string

* Accept new baselines

* Include key type in diagnostic / check symbol-named properties

* Accept new baselines

* Minor fix

* Add tests

* Accept new baselines

* Add optimized findApplicableIndexInfoForName

* Accept new baselines

* Another place we don't need to obtain literal type for property name

* Accept new baselines

* Don't create literal types that are going to be discarded

* Individual maps for string, number, bigint, and enum literal types

* Remove ineffective optimizations

* Accept new baselines

* Permit intersections as key types in index signatures

* Index expression in element access is template literal context

* Add tests

* Accept new baselines

* Symbol index signatures from object literals with computed symbol properties

* Accept new baselines

* Add more tests

* Accept new baselines

* Implement Go To Definition for all applicable index signatures

* Add fourslash test

* Accept new API baselines
2021-06-21 11:25:42 -07:00
Ryan Cavanaugh 5afe42e14e
Rename strictOptionalProperties -> exactOptionalPropertyTypes and remove from strict family (#44626) 2021-06-17 15:12:19 -07:00
Oleksandr T eee34d539c
feat(28491): add QF to declare missing properties (#44576) 2021-06-17 11:12:29 -07:00
Song Gao 971133d5d0
New command line help developer experience. (#44157)
* refactor help CLI output.

* fix typo and omit false condition boolean output.

* fix typo

* add line break

* add --plugins option to basic option category.

* add ts icon and remove old print help function.

* better command description for --jsx.

* Fix test

* fix lint

* Improvements to the UX

* Fix tests

* fix test.

* add missing help out.

* use environemnt variable to control test case.

* fix merge issues.

* No `No Category`

* make getWidthOfTerminal optional.

* fix test

* fix review.

* fix review.

* Update baselines

Co-authored-by: Orta <git@orta.io>
2021-06-16 14:18:00 +01:00
Orta Therox b74b8977d5
Update descriptions for all compiler options (#44409)
* Add new descriptions to compiler options

* Update baselines
2021-06-15 21:20:14 +01:00
Nathan Shively-Sanders e53f19f8f2
Issue "Cannot find name did-you-mean" errors as suggestions in plain JS (#44271)
* Always issue cannot find name did-you-mean error

This PR issues "cannot find ${name}, did you mean ${name}" errors for
identifiers and propery access expressions in JS files *without*
`// @ts-check` and without `// @ts-nocheck`. This brings some benefits of
Typescript's binder to all Javascript users, even those who haven't
opted into Typescript checking.

```js
export var inModule = 1
inmodule.toFixed() // errors on exports

function f() {
    var locals = 2
    locale.toFixed() // errors on locals
}
var object = {
    spaaace: 3
}
object.spaaaace // error on read
object.spaace = 2 // error on write
object.fresh = 12 // OK, no spelling correction to offer
```

To disable the errors, add `// @ts-nocheck` to the file. To get the
normal checkJs experience, add `// @ts-check`.

== Why This Works ==

In a word: precision. This change has low recall &mdash; it misses lots
of correct errors that would be nice to show &mdash; but it has high
precision: almost all the errors it shows are correct. And they come
with a suggested correction.

Here are the ingredients:

1. For unchecked JS files, the compiler suppresses all errors except
two did-you-mean name resolution errors.
2. Did-you-mean spelling correction is already tuned for high
precision/low recall, and doesn't show many bogus errors even in JS.
3. For identifiers, the error is suppressed for suggestions from global files.
These are often DOM feature detection, for example.
4. For property accesses, the error is suppressed for suggestions from
other files, for the same reason.
5. For property accesses, the error is suppressed for `this` property
accesses because the compiler doesn't understand JS constructor
functions well enough.
In particular, it doesn't understand any inheritance patterns.

== Work Remaining ==

1. Code cleanup.
2. Fix a couple of failures in existing tests.
3. Suppress errors on property access suggestions from large objects.
4. Combine (3) and (4) above to suppress errors on suggestions from other, global files.
5. A little more testing on random files to make sure that precision
is good there too.
6. Have people from the regular Code editor meeting test the code and
suggest ideas.

* all (most?) tests pass

* NOW they all pass

* add tonnes of semi-colons

* restore this.x check+add a test case

* make ts-ignore/no-check codefix work in unchecked js

* Issues errors only in the language service

* add a few more tests

* fix incorrect parentheses

* More cleanup in program.ts

* Improve readability of isExcludedJSError

* make diff in program.ts smaller via closure

* Switch unchecked JS did-you-mean to suggestion

Instead of selectively letting errors through.

* undo more missed changes

* disallow ignoring suggestions

* Issue different messages for plain JS than others

Straw text for the messages, I just changed the modals to avoid name
collisions.
2021-06-15 08:54:08 -07:00
Daniel Rosenwasser 9906092db2
Add flag to change catch variables' default types to unknown (#41013)
* Add test case for 'useUnknownInCatchVariables'.

* Add new 'useUnknownInCatchVariables' flag.

* Accepted baselines.

* Add test for catch variable explicitly typed as 'any'.

* Accepted baselines.

* Move option under 'strict'.

* Accepted baselines.

* 'useUnknownInCatchVariables' is strict in command line help.
2021-06-03 13:12:56 -07:00
Orta Therox 6baa1bec64
Improve non-ambient class and function merge error (#44352)
* Improve non-ambient class and function merge error

* Update baselines

* Update tests

Co-authored-by: Austin Cummings <austin@austincummings.com>
2021-06-03 14:08:04 +01:00
Orta Therox 9d345e7734
Rename TSConfig option categories (#42514)
* Update the category descriptions for the tsconfig options

* Gets tests green

* Whitespace change

* Drop command line options from --init

* Go back to the old re-build baseline

* Fix numbers

* Remove formatting options from --showconfig

* Dpon't show output formatting changes in showConfig

* Update baselines

* Update baselines
2021-06-03 12:21:04 +01:00
Anders Hejlsberg 391f9ffb85
Strict optional properties (#43947)
* Introduce --strictOptionalProperties compiler switch

* Accept new baselines

* Removing missingType when printing back optional properties

* Accept new baselines

* Fix linting issue

* Use getNonMissingTypeOfSymbol in getTypeOfSymbolAtLocation

* Properly elaborate errors involving optional properties

* Accept new baselines

* Properly check optional properties in tuple types

* Accept new baselines

* Add missing tuple type check

* More permissive check of strict optional properties and index signatures

* Add tests

* Fix lint issues

* Accept new baselines
2021-06-01 14:52:16 -07:00
Sheetal Nandi 6329a0df90
Add traces for module resolution reuse (#44282) 2021-05-27 11:14:12 -07:00
Oleksandr T 4559855c64
feat(44190): check misspelled base members in override checks (#44213) 2021-05-25 21:24:28 -07:00
Eli Barzilay fb5f855108 Avoid convertExport when there's a non-identifier or a bogus one
Fixes #44105
2021-05-24 14:24:36 -04:00
Nathan Shively-Sanders 4a59b63f35
Error for abstract property with initialiser (#43615)
* Error for abstract property with initialiser

* remove stray LF

* update baselines
2021-05-20 07:18:18 -07:00
Jesse Trinity 5770434891
Revert #43460 and #40884 (#44175)
* Revert "Only issue matching token errors on non-dupe locations (#43460)"

This reverts commit 76a2ae3d69.

* Revert "Adding Diagnostic message for missing ']' and ')' in Array literal and conditional statements (#40884)"

This reverts commit 555ef73da8.

* re-add clobbered merge lines
2021-05-19 16:54:07 -07:00
Oleksandr T 7aacd6b274
fix(43879): forbid async in the left hand in a for-of statement (#43886) 2021-05-12 06:11:08 -07:00
Wenlu Wang 5b1e873b03
Update diagnostic message and quickfix for parameter property (#44010) 2021-05-08 23:22:20 -07:00
Nathan Shively-Sanders f6303652d2
Improve errors for incorrectly nested export default (#43967)
* Improve errors for incorrectly nested export default

The compiler and services don't handle incorrectly nested
`export default` well right now:

```ts
export = (x,y) => {
  export default { }
}
```

Asking for document highlights, find all references or quick info on
'export' or 'default' cause a crash. After the crash is fixed, the error
message is confusing and wrong: "An export assignment cannot be used outside a module."

This PR:

1. Skips document highlights for incorrectly nested export default.
2. Skips find all refs for incorrectly nested export default.
3. Switches the fallback binding for incorrectly nested export default
from Alias to Property. Neither is correct, but Property doesn't cause a
crash in alias resolution.
4. Improves the error message to reflect a post-ES module world, which
has export default and 'module' means 'ES module', not 'namespace'.

Fixes #40082 and the related bugs mentioned above.

* address PR comments
2021-05-07 08:09:38 -07:00
Nathan Shively-Sanders 004b3ae018
Simplify arity errors, rewording spread errors (#43855)
* Scribbles + tests

The second test actually requires node types

* Basically working

The two simple fixes, in arity error reporting, are in, and the
simplification of arity error reporting is half-done. I haven't started
on any improvements to call assignability.

* trim out too-real test case

* Finish cleanup

And reword error a little.

* Simplify and reword spread errors

* handle spreads first

* update baselines

* Address PR comments
2021-04-29 14:38:50 -07:00
Acy Watson b31b0eb05c
Use single quotes consistently in diagnostic messages. (#43634) 2021-04-29 07:15:31 -07:00
Sheetal Nandi f6d425e1e3
Module Resolution and Type Reference directive cache updates and its API changes (#43700)
* Make the module resolution cache apis for updating compiler options or clearing it

* Cache package.json lookup results from module resolution

* Use per directory cache for type reference directive resolution as well

* Update Baselines and/or Applied Lint Fixes

* Change trace according to feedback

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-04-21 21:30:18 -07:00
Andrew Casey c671fe1bc2
Skip up-to-date checks during force build (#43666)
* Skip up-to-date checks during force build

Save work by not checking timestamps or parsing the buildinfo file.
Retain correctness checks (like input file existence).

Suppress project status, which was confusing anyway.

* Print a message to indicate that --force is causing the rebuild

* Don't bother updating buildInfoChecked

* Add missing force check
2021-04-19 13:06:00 -07:00
Andrew Branch 06a73655d0
Don’t error for missing await when promise is referenced in condition body (#43593) 2021-04-13 12:15:48 -07:00
Josh Goldberg fe4a6709da
Specified diagnostic for CLI flags mismatched with/out --build (#43199)
* Specified diagnostic for CLI flags missing a required --build

* Switched to an alternateMode member

* Added --build-incompatible flags too

* Small fixups to remove a hardcoding

* Switched to ||= factories

* Not a function

* I think I get it now
2021-04-07 16:03:17 -07:00
Josh Goldberg a4c683be12
Again: Improve error messages for empty DOM interface property access (#43007)
* Again: Improve error messages for empty DOM interface property access

* containerSeemsToBeEmptyDomElement

Co-authored-by: Daniel Rosenwasser <drosenwasser@microsoft.com>

* isEmptyObjectType; unescapeLeadingUnderscores

* Single tick quotes for now

* Undo accidental diagnostic change

* Correct new baseline

Co-authored-by: Daniel Rosenwasser <drosenwasser@microsoft.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-04-07 12:54:27 -07:00
Josh Goldberg 905a1fea39
Corrected parsing for decorators on 'this' parameters (#43175)
* Corrected parsing for decorators on 'this' parameters

* Moved checking to parser and added a specific test

* Remove unrelated checker.ts blank line

* Missed some baseeline updates...
2021-04-07 11:21:28 -07:00
Titian Cernicova-Dragomir 2484210a00
Gh 41788 incorrect output for esprivate with nested class in esnext (#42663)
* If target:esnext,then useDefineForClassFields: true will now be the default.

* Added error if a private identifier is used in a static a initializer if target:ESNext and useDefineForClassFields:false.

* Added test for new useDefineForClassFields default and error message.

* Fixed tests after changing the default of useDefineForClassFields to true for target esnext

* Fixed code review suggestions.

* Updated error message.

* Added missing static check for the containing property. Fixed other code review issues.
2021-04-07 08:23:16 -07:00
Wenlu Wang 62f3ccd9c0
Error if assignment after block (#41115)
* Error if assignment after block

* Update src/compiler/diagnosticMessages.json

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Fix diags

* Error after block

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-31 15:57:25 -07:00
keerthana1212 555ef73da8
Adding Diagnostic message for missing ']' and ')' in Array literal and conditional statements (#40884)
* Adding Diagnostic message for missing ']' in Array literal

* revert change on parseArrayBindingPattern

* Adding diagnostic message for if, while, do and with statements

* Extract parseExpectMatchingBrackets

Co-authored-by: Keerthana Kanakaraju <kekanaka@microsoft.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-30 13:13:57 -07:00
Daniel Rosenwasser a3d207a905
Improve (and actually use) "always truthy promise" error (#43023)
* Modify error message and actually use the error message.

* Accepted baselines.
2021-03-29 12:44:05 -07:00
Ryan Cavanaugh ff233a9ac2
Variant accessors (#42425)
Allows accessors to have different access modifiers and types

Fixes #2845, #2521
2021-03-26 20:11:02 -07:00
Wenlu Wang 2f0c8b2bea
--noImplicitOverride (#39669)
* wip: add types

* wip

* Add cases

* Add some case

* Add more check

* accept baseline

* add abstract abd declare method

* add override in declaration

* accept baseline

* add property override

* Fix decalre modifier

* update baseline

* Add more cases

* make lint happy

* make lint happy

* Update description

* Add codefix

* simplify code

* accept baseline

* Update desc

* Accept baseline

* Add override completions

* filter out implements field in override context

* fix tests

* Add parameter property check

* Accept baseline

* acept baseline

* Add parameter property to declaration code action

* Add quickfix for override parameter property

* fix code style

* Add override with interface tests

* Add more cases about modifier position

* rename flag

* rename flags

* Added tests.

* Accepted baselines.

* Always issue errors for unnecessary 'override' modifiers.

* Accepted baselines.

* Override perf (#4)

* try cache check result

* pre check for override

* Do not issue error if implement abstract

* Add abstract-spec check

* Avoid override dead lock

* Add more case

* Add codefix for new error

* Fix error message

* Add jsdoc override tag (#6)

* Override jsdoc tag (#7)

* accept baseline

* Disallow codefix in js

* update baseline

* Omit override in d.ts

* Add more case in js

* Accept baseline

* fix override js test

* fix crlf

* Revert merge conflict changes

* Accept baseline

* Avoid space

* Fix CR issues

* Accept baseline

* Fix typo and add more check

* Fix error name

Co-authored-by: Daniel Rosenwasser <Daniel.Rosenwasser@microsoft.com>
2021-03-26 16:29:22 -07:00
Titian Cernicova-Dragomir e638af7560
ES private class elements (#42458)
* Added support for private identifier methods.

* Added tests for private methods.

* Added check to only not allow private name method signatures in anything except classes.
Changes objects literal checking to not bail on first private name found in object literal.

* Added private accessors tests

* Transform private methods

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Rename shouldTransformPrivateFields

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Accept baseline

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Use a single WeakSet for brand-check

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Accept baseline

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Add a test for using private methods in static field initializers

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Add breaking checker test

Private methods inside class expressions should not error.

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Add to instances once per-instance

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Accept baseline

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* fix: evaluate receiver and rhs expressions before throwing on readonly assignment

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Add a test for evaluating rhs before readonly assignment

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Transpile private accessors

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Accept baseline

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* fix: handle readonly/writeonly accessors

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* accept baseline

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* add a test for private setter without a getter

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* fix: getAllUnscopedEmitHelpers

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* fix: better handling of duplicate names

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Fixed wrong error message for private methods in class expressions.

* change error message

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* add a test for async private methods with a higher target

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* fix: setter assignment returns rhs value

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* add a test for setter assignment return value

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* fix: handle duplicate accessors

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* add tests for duplicate accessors

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* docs: add missing parameter docs

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Fixed failing test.

* baseline-accept: ordering changes

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* fix: attach weakSetName to property declaration

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* add a test for nested private methods

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* add a test with any

Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>

* Added support for static private fields accessors and methods.

* Added error message for private identifiers used with static decorators. There is no spec to go with this behavior as of yet.

* Fixed emit static bug that used private names outside of classes for initialization in esnext. Fixed issue where nested privates produce incorrect brand check.

* Added tests for private static fields methods and accessors.

* Fixed error messages and tests after merge.

* Accept new baseline.

* Improved duplicate identifier checks for static private class elements.

* Added error when using initializers with private static fields when useDefineForClassFields is not specified and target is esnext.

* Fixed code review issues.

* Removed semantically wrong emit on `useDefineForClassFields:true` with `target:esnext`

* Changed emit for uninitialized private static fields.

* Added runtime error in helper if a static private field is accessed before it was declared.

* Fixed code review comments for private identifier static class elements.

* add debug.assertNever for unknown node type (#53)

* Fixed code review issues.

* Fixed code review issues for private class elements.

* Fixes class shadowing when checking access to a private static class element.

* fix private methods/accessors in class expr inside a loop

* collapse switch case

* fix class name

* simplify getPrivateMethodsAndAccessors

* remove findPreviousAccessorInfo

* lazily create weakSetName identifier

* do not allocate a node if not needed in visitMehodDeclaration (#55)

* Removed all the emit helpers for private identifier methods accessors and modified the existing helpers for get and set fields to do the same job.

* Simplified emit for private identifier class elements.

* do not clone the receiver (#57)

* leave bad code in for #constructor and duplicate private names (#58)

* Added check for WeakSet collision.

* Added error for using a set only accessor.

* update keyof tests and ?? (#62)

* replace ?? with ||

* update keyof tests

* fix emit helpers comments

* produce an error if private field helpers are not up to date

* add tests

* fix setter-only compound assignment

* fix tests

* fix duplicated trailing comments (#64)

* clear receiver pos and setTextRange on helper calls

Co-authored-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
2021-03-24 18:15:50 -07:00
Wesley Wigham 9a256a1935
Adjust scanning of keywordy jsx namespace names, add grammar error for jsx dotted names containing namespace names (#43104) 2021-03-22 10:28:43 -07:00
Hai Lin Zhang e44d39d4eb
Updated error message for TS2539 (#39827)
* Updated error message for TS2539

* Switch to multiple error messages

* inline variable

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-11 15:51:15 -08:00