Commit Graph

1666 Commits

Author SHA1 Message Date
Ron Buckton dfd28d2751 Fix handling of empty 'types', 'typings', etc. fields in package.json (#31539) 2019-05-23 17:19:32 -07:00
Titian Cernicova-Dragomir 8ab0a25211 Improve error messages when indexing into a type (#31379)
* Improved error messages when indexing an object type with a literal string, a literal string union or a string.

* Added more specific message when using the indexing operator with an incompatible index argument.

* Fixed spelling and error message.
2019-05-23 15:27:50 -07:00
Nathan Shively-Sanders 4d27361680 Allow JS with isolated modules (#31483)
* Allow JS with isolated modules

Previously legacy JS code was not allowed; it was required to use ES6
module syntax. Unfortunately, the check happens after parsing but before
binding, and the commonjs module indicator isn't set until binding
because it's not syntactically simple like the ES6 module indicator,
which is set during parsing.

So I decided that JS should be allowed during isolatedModules
unconditionally. We're not going to be transforming it anyway.

* Update baselines

* Switch test to outDir instead of noEmit
2019-05-23 11:09:28 -07:00
Sheetal Nandi 85d3c5d7a1 Trace Package id at the module resolution site 2019-05-22 12:35:20 -07:00
Wenlu Wang 714821fc97 add refactor of extract type (#30562)
* add basically implement

* add rename location and add testcase

* collection type arguments

* disallow infer type

* add support for typedef convert

* refactor info to make type safe

* disallow type pred

* avoid unnecessary branch

* disallow type query

* haha😂

Co-Authored-By: Kingwl <kingwenlu@gmail.com>

* Update src/services/refactors/extractType.ts

Co-Authored-By: Kingwl <kingwenlu@gmail.com>

* Update src/services/refactors/extractType.ts

Co-Authored-By: Kingwl <kingwenlu@gmail.com>

* add more tests

* add template tag support in jsdoc

* add support of type parameters constraint

* add more tests

* merge branch

* add more tests

* refactor and update function name
2019-05-07 08:26:53 -07:00
Andrew Branch 56b19c9bf0 Merge pull request #31119 from andrewbranch/bug/31020
Emit grammar error on quoted constructors and class fields named “constructor”
2019-05-01 10:42:16 -10:00
uhyo b0143bb446 add relatedInfo to error message for 'await' used in non-async function 2019-05-02 02:33:24 +09:00
Josh Goldberg 6e736c120e Added custom error message when trying to assign constraint type to generic type parameter (#30394)
* Added custom error message when trying to assign constraint type to generic type parameter

Fixes #29049.

This also adds the new message in chained error messages. `typeParameterDiamond4.errors.txt` shows it appearing twice in the "diamond" scenario. I can't tell if this severely increased amount of nested messages is good or bad...?

* Updated diagnostic message per suggestion

* Align formatting with local custom
2019-04-30 08:35:22 -07:00
Collins Abitekaniza 7016d45447 Better errors for indexing gettable/settable values (#26446)
* give suggestions when index signature given

* add tests for noImplicitAny indexing on Object

* remove comments regarding error messages

* recommend set if el is on RHS of assignment else get

* add new baseline tests
2019-04-30 08:31:37 -07:00
Andrew Branch e81fa2198d Emit error on class fields named "constructor" 2019-04-25 17:30:41 -07:00
Andrew Branch 9f601ff154 Change error code 2019-04-25 16:15:00 -07:00
Andrew Branch c5e6913ede Add grammar error on quoted constructors for TS 3.5 2019-04-25 15:44:23 -07:00
amaksimovich2 5b79b942e8 add action for enabling experimentalDescorators option in user config… (#30484)
* add action for enabling experimentalDescorators option in user config file, change error message for this case #29035

* add missing changes in tests

* Add "experimental decorators" tests for jsconfig file
2019-04-25 14:55:04 -07:00
Ely Alamillo 591b25593d update error message and update baselines (#27628) 2019-04-25 13:16:41 -07:00
Wenlu Wang bc46c770bf allow literan enum const assertions (#30700)
* allow literan enum const assertions

* update desc
2019-04-25 10:09:21 -07:00
Ryan Cavanaugh 885d4d63c8 Remove "generate types" code (#31075) 2019-04-23 13:51:47 -07:00
Daniel Rosenwasser c74d25c115 30837 - Bad error message when default 'import'-ing an 'export =' without 'esModuleInterop' (#30847)
30837 - Bad error message when default 'import'-ing an 'export =' without 'esModuleInterop'
2019-04-23 11:23:06 -04:00
karthikkp 181d126b02 diagnostic messages conflicts resolved 2019-04-20 01:38:17 +05:30
Andrew Branch b6a0988052 Merge pull request #30776 from andrewbranch/feature/10178
Add flag to allow access to UMD globals from modules
2019-04-18 18:05:44 -07:00
Alexander T f5d4e66451 Bad error message when default 'import'-ing an 'export =' without 'esModuleInterop' 2019-04-16 14:39:16 +03:00
Daniel Rosenwasser 3dc78b6f3b Merge pull request #30916 from jack-williams/array-elaboration
Elaborate array and tuple relation errors
2019-04-15 14:00:22 -07:00
Andrew 13d9f08976 Gracefully parse 'super' with type arguments (#10677) (#30913) 2019-04-15 13:06:29 -07:00
Jack Williams 2ea91a0e9c Elaborate array and tuple relation errors 2019-04-15 18:16:38 +01:00
Andrew Branch 28b21df943 Add period to compiler flag description to match others 2019-04-08 09:46:47 -07:00
Andrew Branch 2ee93bf0f2 Add allowUmdGlobalAccess flag 2019-04-08 09:46:46 -07:00
Alexander T 75a812b4db add new message - TS1258 (#30704) 2019-04-03 09:49:34 -07:00
Sheetal Nandi 35470b3f3b Make tsbuildInfoFile as commandline option to tsc (and not tsc -b) 2019-03-25 14:47:36 -07:00
Sheetal Nandi 722afc18bb Fix typo 2019-03-21 09:01:52 -07:00
Sheetal Nandi 34c3233d18 Allow --incremental to be command line option 2019-03-20 14:48:47 -07:00
Gabriela Britto 1c8a359914 rename convert to named parameters (#30401) 2019-03-14 13:41:29 -07:00
Wenlu Wang d2476759e2 add related error span for default exports (#25396)
* add related error span for default exports

* accept baseline

* stash

* accept baseline and fix lint

* update testcase

* Add missing semicolon
2019-03-12 13:15:14 -07:00
Sheetal Nandi 68e28da141 Build project if existing project was built with different compiler version 2019-03-08 15:14:34 -08:00
Sheetal Nandi 990b199ebd Merge branch 'master' into incrementalBuildInfo 2019-03-08 11:42:19 -08:00
Sheetal Nandi fe9f42480a Handle error when type parameter of mapped type uses private type
Fixes #30201
2019-03-06 13:30:48 -08:00
Gabriela Britto d2364f555f Merge pull request #30089 from Microsoft/convert-to-named-parameters
Convert to named parameters
2019-03-06 09:33:01 -08:00
Sheetal Nandi 223d42847b Merge branch 'master' into incrementalBuildInfo 2019-03-01 11:39:44 -08:00
Sheetal Nandi cd195c91c6 Add options tsBuildInfoFile to provide name for the buildinfo file 2019-03-01 10:28:57 -08:00
Sheetal Nandi df9da15abb Incremental false with composite not allowed 2019-03-01 09:39:58 -08:00
Sheetal Nandi d53efdf380 Changes to generation of .tsbuildinfo:
- If composite or incremental then only the .tsbuildinfo will be generated
- if --out or --outFile the file is outputFile.tsbuildinfo
- if rootDir and outDir then outdir/relativePathOfConfigFromRootDir/configname.tsbuildinfo
- if just outDir then outDir/configname.tsbuild
- otherwise config.tsbuildinfo next to configFile
2019-02-28 13:46:26 -08:00
Anders Hejlsberg 237c33b444 Merge pull request #30109 from Microsoft/circularConstraintErrors
Consistently error on circular constraints
2019-02-28 10:57:01 -10:00
Gabriela Araujo Britto 617d5af67e add diagnostics message for refactor description 2019-02-28 11:22:05 -08:00
Sheetal Nandi ed35741b5f Merge branch 'master' into incrementalBuildInfo 2019-02-27 15:45:59 -08:00
Nathan Shively-Sanders be2db9db12 Add globalThis (#29332)
* Restore original code from bind-toplevel-this

With one or two additional comments

* Working in JS, but the symbol is not right.

Still need to

1. Make it work in Typescript.
2. Add test (and make them work) for the other uses of GlobalThis:
window, globalThis, etc.

* Check in TS also; update some tests

Lots of tests still fail, but all but 1 change so far has been correct.

* Update baselines

A couple of tests still fail and need to be fixed.

* Handle type references to globalThis

The type reference must be `typeof globalThis`. Just `globalThis` will
be treated as a value reference in type position -- an error.

* Restore former behaviour of implicitThis errors

I left the noImplicitThis rule for captured use of global this in an
arrow function, even though technically it isn't `any` any more --
it's typeof globalThis.  However, you should still use some other method
to access globals inside an arrow, because captured-global-this is super
confusing there.

* Test values with type globalThis

I ran into a problem with intersecting `Window & typeof globalThis`:

1. This adds a new index signature to Window, which is probably not
desired. In fact, with noImplicitAny, it's not desired on globalThis
either I think.
2. Adding this type requires editing TSJS-lib-generator, not this repo.

So I added the test cases and will probably update them later, when
those two problems are fixed.

* Add esnext declaration for globalThis

* Switch to symbol-based approach

I decided I didn't like the import-type-based approach.

Update baselines to reflect the difference.

* Do not suggest globals for completions at toplevel

* Add tests of element and property access

* Look up globalThis using normal resolution

globalThis is no longer constructed lazily. Its synthetic Identifier
node is also now more realistic.

* Update fourslash tests

* Add missed fourslash test update

* Remove esnext.globalthis.d.ts too

* Add chained globalThis self-lookup test

* Attempt at making globalThis readonly

In progress, had to interrupt for other work.

* Add/update tests

* Addres PR comments:

1. Add parameter to tryGetThisTypeAt to exclude globalThis.
2. Use combined Module flag instead combining them in-place.
3. SymbolDisplay doesn't print 'module globalThis' for this expressions
anymore.
2019-02-27 14:14:34 -08:00
Anders Hejlsberg ede6b9a5cb Issue errors for all circular type parameter constraints 2019-02-26 12:39:01 -08:00
Sheetal Nandi e1b18ab5fb Merge branch 'master' into incrementalBuildInfo 2019-02-22 14:19:53 -08:00
Sheetal Nandi 494bd92f1b Report error if overwriting buildInfo of another project reference 2019-02-21 19:34:20 -08:00
Sheetal Nandi 89c4c4f684 Update the message to not just mean javascript since we might need to regenerate .d.ts as well 2019-02-21 17:52:15 -08:00
Daniel Rosenwasser 4a256abc8a Give a related span pointing to the implementation signature when reporting incompatibility. 2019-02-21 10:51:18 -08:00
Daniel Rosenwasser cee933ff09 Be more specific in errors. 2019-02-21 10:50:14 -08:00
Sheetal Nandi a881391dc9 Merge branch 'master' into incrementalBuildInfo 2019-02-20 10:37:44 -08:00