1130 Commits

Author SHA1 Message Date
Wesley Wigham
61cb06ce40
Allow allowJs and declaration to be used together (#32372)
* Allow allowJs and declaration to be used together

This intorduces a new symbol-based declaration emitter - currently this
is only used for JSON and JavaScript, as the output is likely worse than
what the other declaration emitter is capable of. In addition, it is
still incomplete - it does not yet support serializaing namespaces.

* Add tests for various import/export forms, add notes on export as namespace and fix export * from

* Tests & fixes for computed names

* Add test with current @enum tag behavior

* fix declaration emit for jsdoc @enum tags

* Small adjustments to base class serialization to fix bugs in it

* Guard against type/type parameter confusion when using typeParameterToName a bit

* Integrate feedback from PR

* Fix issue with export= declarations visibility calculation and type declaration emit that impacted all forms of declaration emit

* Only make one merged getCommonJsExportEquals symbol for a symbol

* Support preserving type reference directives in js declarations

* Skip declare mdoifiers for namespace members in ambient contexts

* FAKE ALIASES AND NAMESPACES EVERYWHERE

* Dont do namespace sugar when type members contain keyword names

* Fix json source file export modifier under new output

* Such clean nested aliasing, very wow

* Fix lint

* Add visibility errors, reuse type nodes where possible

* Suppoer having correctly named import types in bundled js declaration emit & adjust binding to allow namespaces with aliases to merge when the aliases look to be type-only

* Better support for module.exports = class expression

* Fix discovered crash bug

* Allow export assigned class expressions to be reachable symbols from external declarations

* Add missing semicolon

* Support @enum tag post-merge

* preserve comments on signatures and declarations where possible

* Basic support for js classy functions

* Add example we should do better with

* Prototype assignments make things a bit wonky, but the example from the PR seems OK

* Make a ton of changes to support the new way js classes are bound

* Remove some old comments, fix import and export default names

* Fix bug in object define handling and add tests for object define property declaration emit

* Fix organization nits from PR comments

* Preserve comments from jsdoc declarations on properties and js declaration type aliases

* Merge export declarations with identical specifiers

* Remove completed TODO comment

* Split lint

* Remove now-unused function

* PR feedback

* Add some project references tests, remove some checks from project refs codepaths that are now invalid

* Update project references tests again

* Merge and update project references tests

* Rename case

* Update test to include declaration output

* Remove yet another project refernces redirect extension check

* Update comment

* Add additional import ref to test

* Add shorthand prop to test

* Fix comment text

* Extract var to temp

* Simplify function and add whitespace

* Update project refs test to use incremental edit entry

* Stylistic refactors in the symbol serializer

* Another round of PR feedback, mostly style, small bugfix with constructors, and test showing bug in export assigned class expression name shadowing

* Use x instead of index
2019-09-26 14:27:16 -07:00
Nathan Shively-Sanders
500a0df6f3
Add useDefineForClassFields flag for Set -> Define property declaration (#33509)
* Disallow property/accessor overrides

Unless the base property or accessor is abstract

* Disallow uninitialised property overrides

This causes quite a few test breaks. We'll probably want to revert many
of them by switching to the upcoming `declare x: number` syntax.

* Updates from design review + fix ancient bug

1. Don't error when overriding properties from interfaces.
2. Fix error when overriding methods with other things. This had no
tests so I assume that the code was always dead and never worked.

* Need to add a couple of errors and squash one

Will update after checking out other branch for a minute

* Everything works so far

Need to test properties initialised in constructor

* Check for constructor initialisation

* change error wording

* Improve error wording

* Add codefix to add missing 'declare'

* Always emit accessors in .d.ts files

* Allow 'declare' on any uninitialised property decl

* Undo code moves

* Let sleeping dogs lie

* Correctly set NodeFlags.Ambient

And simplify redundant parts of check.

* Remove more unneeded code

* Update baselines

* Update baselines

* Update baselines

* Ignore this-property assignments

* Fix base-in-interface check

* Do not error when base parent is interface

* Fix base interface check

* Add missed baselines

* Fix check

* Fix new errors in services

* Fix new errors in services

* Fix errors in testRunner

* Add flag and turn off errors when on

* Structure of new emit is correct, fake content

It is 'hi'.

* Basically right emit

* Fix one last unitialised property declaration

* Haha no I missed another one

* Fix whitespace back to CRLF

* Minor fix and code cleanup

* New test case

* Fix bug in isInitializedProperty

* Updates from design meeting.

1. Change flag name to useDefineForClassFields (and flip polarity).
2. Forbid ES3 + useDefineForClassFields (since there is no
defineProperty).
3. Forbid overriding an abstract property-with-initializer with an
accessor.

* Update baselines

* Object.defineProperty for methods too

Using code from Ron from his upcoming refactor of the factory functions.

* Update slow baselines

* Improve error message

* Update src/compiler/transformers/utilities.ts

Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>

* Add test of computed properties

* Remove done TODO
2019-09-26 13:25:05 -07:00
Orta Therox
4c9986f26c Merge master 2019-09-25 12:59:07 -04:00
Sheetal Nandi
992c211c22
Merge pull request #32028 from microsoft/referencesPrototypeSourceFile
For editing experience, use source instead of .d.ts files from project references
2019-09-24 13:16:53 -07:00
Sheetal Nandi
7f004ad8df
Merge pull request #33380 from microsoft/isolatedModules
With --isolatedModules, --declaration emit is now allowed and builder handles it for incremental compilation
2019-09-19 16:20:21 -07:00
Sheetal Nandi
e430f2a81c Add output file names api for supporting ts-loader 2019-09-18 14:13:49 -07:00
Orta
0cf00fab93
Merge pull request #32965 from ajafff/ts-in-js
Detect more TS syntax in JS files
2019-09-12 20:21:51 +02:00
Sheetal Nandi
07b9715fde Allow .d.ts with --isolatedModules
Fixes #29490
2019-09-11 12:44:53 -07:00
Sheetal Nandi
c0f0d9f798 Merge branch 'master' into dtsOnlyEmit 2019-09-11 12:42:48 -07:00
Sheetal Nandi
b26ca160f4 Merge branch 'master' into referencesPrototypeSourceFile 2019-09-11 12:27:58 -07:00
Orta
2c967c49eb
Merge branch 'master' into ts-in-js 2019-09-11 21:22:01 +02:00
Sheetal Nandi
11fd654cf9 Separate emitOnlyDtsFiles and forcing dts emit (for builder signature detection where we want it irrespective of settings) 2019-09-09 16:22:50 -07:00
Justin Bay
3c9e338396 Only error when testing functions that are not used in the following block 2019-08-31 18:29:11 -04:00
Sheetal Nandi
a469fd82b9 Should not report that files are not part of config for files that are not going to be emitted 2019-08-22 13:37:36 -07:00
Sheetal Nandi
4c4ddf833d Merge branch 'master' into referencesPrototypeSourceFile 2019-08-21 15:42:36 -07:00
Alexander T
fd72a1c76b @typescript-eslint/unified-signatures 2019-08-19 13:38:58 +03:00
Klaus Meinhardt
1d942f4ddc Detect more TS syntax in JS files
* optional class methods
* type arguments on tagged template expressions
2019-08-18 21:46:53 +02:00
Alexander T
b6d981aec8 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-16 12:13:57 +03:00
Tan Li Hau
dcb763f624 Report error when using generic class in js file (#31723)
* Report error when using generic class in js file

* Replace "ClassDeclaration | ClassExpression" to ClassLikeDeclaration

Co-Authored-By: Klaus Meinhardt <klaus.meinhardt1@gmail.com>

* add noEmit:true
2019-08-15 15:49:50 -07:00
Ryan Cavanaugh
0bc3468733
small refactor to cut back on type assertions (#32920) 2019-08-15 15:18:27 -07:00
Alexander T
f20a2828f2 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-15 10:32:45 +03:00
Sheetal Nandi
0e93cf61fc Disallow incremental with noEmit
Fixes #32882
2019-08-14 09:47:49 -07:00
Sheetal Nandi
31a26120f9
Merge pull request #32788 from microsoft/tsbuildFixes
Fixes for tsbuild scenarios
2019-08-14 09:07:24 -07:00
Alexander T
b728bf4bfa Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-14 13:42:02 +03:00
Wesley Wigham
602966ba4e
Fix references to path-mapped ambient modules in declaration files (#32878)
* Fix references to path-mapped ambient modules in declaration files

* Fix lint
2019-08-13 16:34:03 -07:00
Sheetal Nandi
8ac45805c0 Add error related to file not in rootDir and file not part of included root files at the references 2019-08-09 14:19:40 -07:00
Alexander
ceccfd8867 array-type: [ default: array, generic: array ] 2019-08-08 21:30:18 +03:00
Alexander
4d23429d98 fix eslint errors 2019-08-04 16:00:57 +03:00
Alexander
a292ae1789 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-04 15:35:41 +03:00
Wesley Wigham
00a75c4283
Retarget to es6 and fix the resulting bugs (#32221)
* Retarget to es6 and fix the resulting bugs

* Set target back to es5

* Fix typos in declaration emitter
2019-08-01 14:23:57 -07:00
Sheetal Nandi
c25e7dd873 Wire in compilerOptions of the program in to the host's resolveModuleNames and resolveTypeReferenceDirectives api
Fixes #31056
2019-07-31 12:01:49 -07:00
Alexander T
2c32308f35 no-null/no-null 2019-07-18 10:50:38 +03:00
Sheetal Nandi
103fe5fbc5 Merge branch 'master' into referencesPrototypeSourceFile
Uptodate to 3.6.0-dev.20190711
2019-07-11 12:05:36 -07:00
Sheetal Nandi
b631850978 Add option disableSourceOfProjectReferenceRedirect to disable using sources of project reference redirect from editor 2019-07-10 15:49:53 -07:00
Alexander T
9d01ef0f8e Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-07-10 14:36:10 +03:00
Sheetal Nandi
15b68a9396 Skip typechecking of source of project reference redirect 2019-07-03 15:39:29 -07:00
Nathan Shively-Sanders
722917f04e Remove TODO 2019-07-03 09:50:03 -07:00
Nathan Shively-Sanders
e62d84cd88 Merge branch 'master' into report-multiple-overload-errors 2019-07-03 09:28:44 -07:00
Alexander T
9f474150c6 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-07-02 17:57:44 +03:00
Sheetal Nandi
f7ea0bab60 Refactoring 2019-07-01 14:33:39 -07:00
Sheetal Nandi
4d13f53df8 Merge branch 'master' into referencesPrototypeSourceFile 2019-07-01 11:50:11 -07:00
Sheetal Nandi
f72af3be60 Verify the scenarios when d.ts directory of dependency doesnt exist 2019-07-01 11:34:57 -07:00
Sheetal Nandi
96a8c86c65 Merge branch 'master' into referencesPrototypeSourceFile 2019-06-28 12:42:22 -07:00
Sheetal Nandi
4f802e7205 When checking sourceFile is from external library, use sourceFile.resolvedPath since thats how the source files are queried and thats the real path
Fixes #32086
2019-06-28 10:14:33 -07:00
Nathan Shively-Sanders
ba9d8e2e81 Switch DiagnosticMessageChain to be a tree 2019-06-27 16:30:35 -07:00
Sheetal Nandi
da9260c013 Create original project when location is in source of project reference redirect 2019-06-27 10:38:52 -07:00
Alexander T
769bb0b475 remove tslint configuration 2019-06-27 13:49:35 +03:00
Sheetal Nandi
012ecdacde Add sourceOf project reference redirect to filesByName list for redirect path so that module symbol is correctly resolved 2019-06-26 14:56:21 -07:00
Alexander
7389200ce2 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-06-23 18:49:35 +03:00
Alexander T
702dc59b36 no-fallthrough 2019-06-22 10:50:25 +03:00