Commit graph

828 commits

Author SHA1 Message Date
Donald Pipowitch e4d6752a93 add createProgram docs (#15697)
* add `createProgram` docs

* updated `createProgram` docs
2017-05-23 10:40:46 -07:00
Andy 38ece3b703 Merge pull request #15737 from Microsoft/findAllRefs_module
Support find-all-references for a module specifier
2017-05-19 08:11:56 -07:00
Andy Hanson 0ff187c8ac Remove 'isDeclarationFile()' function, use '.isDeclarationFile' 2017-05-17 08:12:23 -07:00
Sheetal Nandi ec2f9670d9 Merge branch 'master' into ownJsonParsing 2017-05-15 11:36:45 -07:00
Alex Eagle 4240f6f5d9 Extract diagnostics formatter used by --pretty
This allows compilers other than tsc.js to display nice in-context diagnostics
2017-05-12 16:19:46 -07:00
Sheetal Nandi d7e9609ae5 Merge branch 'master' into ownJsonParsing 2017-05-11 09:10:35 -07:00
Andy Hanson 71fb02c099 Support find-all-references for a module specifier 2017-05-10 11:02:17 -07:00
Kanchalai Tanglertsampan 1b7d3bfa07 Merge branch 'master' into master-dynamicImport 2017-05-04 10:14:32 -07:00
Arthur Ozga 2150a7796b Merge pull request #15261 from aozgaa/moduleReuse
Reuse Module Resolutions from Unchanged Files
2017-05-01 17:49:44 -07:00
Arthur Ozga 60825143a4 respond to comments 2017-05-01 17:49:19 -07:00
Arthur Ozga 2118de09e7 Simplify returns 2017-05-01 15:16:42 -07:00
Arthur Ozga ef1cd50dfc clarifying comments 2017-05-01 11:47:12 -07:00
Arthur Ozga c63d6d145a Avoid double-resolving modified files 2017-04-28 16:27:41 -07:00
Arthur Ozga 86d7031932 inline createOldProgramState 2017-04-28 10:40:31 -07:00
Arthur Ozga 6547c1816f check ambient modules before reusing old state 2017-04-27 20:27:48 -07:00
Yui T feb41f7d7c Merge branch 'master' into master-dynamicImport
# Conflicts:
#	src/compiler/diagnosticMessages.json
#	src/compiler/program.ts
2017-04-26 15:35:30 -07:00
Yui T e50667e49e Address minor PR comment 2017-04-26 15:02:54 -07:00
Yui T 2f61d472ed Address minor PR comment 2017-04-26 12:56:15 -07:00
Arthur Ozga ac20fc2d26 consolidate program-structure reuse flags 2017-04-21 16:54:42 -07:00
Arthur Ozga 0ea1b82a85 test module reuse 2017-04-20 18:55:15 -07:00
Arthur Ozga 7966c08cc4 make enum bitflag and add trace message 2017-04-20 11:02:35 -07:00
Arthur Ozga 044152e50f Merge branch 'moduleReuse' of github.com:aozgaa/TypeScript into moduleReuse 2017-04-19 11:13:52 -07:00
Arthur Ozga c3582d2443 cleanup 2017-04-18 16:23:01 -07:00
Mohamed Hegazy 8c33a792b3 Do not query for bind errors if skipLibCheck or skipDefaultLibCheck is set 2017-04-18 16:19:58 -07:00
Arthur Ozga 77f9099423 Remove WIP comment 2017-04-18 16:15:39 -07:00
Arthur Ozga d5f246fd99 Reuse module resolutions in unmodified files 2017-04-18 15:48:01 -07:00
Mohamed Hegazy e6ecfa46f0 Merge pull request #15229 from Microsoft/Fix15220
Fix #15220: Check for file on diagnostics before getting line map
2017-04-18 14:39:54 -07:00
Andy Hanson 455492d887 Merge branch 'master' into fallthrough 2017-04-18 09:48:21 -07:00
Arthur Ozga cbbf6f8847 Merge branch 'master' into tripleEquals 2017-04-17 15:57:51 -07:00
Sheetal Nandi 6f568b3f26 Merge branch 'master' into ownJsonParsing 2017-04-17 13:40:49 -07:00
Mohamed Hegazy 26d5af384c Check for the file before getting line map 2017-04-17 13:15:06 -07:00
Andy Hanson a82ac45e36 Merge branch 'master' into fallthrough 2017-04-12 10:58:03 -07:00
Andy Hanson ed5eca2b7b boolean-trivia lint rule: Enforce space between comment and argument 2017-04-11 09:44:58 -07:00
Andy Hanson 7320891933 boolean-trivia lint rule: Lint for null/undefined too 2017-04-07 13:13:39 -07:00
Arthur Ozga 7e03429a8e enforce triple-equals 2017-04-04 15:51:13 -07:00
Kanchalai Tanglertsampan 55430c46e6 Add boolean flag to not walk the tree if there is no dynamic import 2017-04-04 15:43:45 -07:00
Kanchalai Tanglertsampan 11f6eaec5b Merge branch 'master' into master-dynamicImport
# Conflicts:
#	src/compiler/commandLineParser.ts
2017-03-29 10:51:05 -07:00
Andy Hanson 1cf765d664 Lint for fallthrough in switch 2017-03-27 15:09:00 -07:00
Mohamed Hegazy db6c96967c Change ingore diagonstic comment to // @ts-ignore 2017-03-22 16:23:21 -07:00
Mohamed Hegazy e408cad618 Merge branch 'master' into checkJSFiles 2017-03-22 15:45:27 -07:00
Kanchalai Tanglertsampan c798489eb1 Move error report of incorrect grammar in dynamic import to checker 2017-03-22 15:04:17 -07:00
Kanchalai Tanglertsampan 91d9ecf3e2 Simply parse dynamic import as call-expression.... 2017-03-22 11:10:47 -07:00
Kanchalai Tanglertsampan e0192168f7 Use emitFlags to indicate that the subtree contains dynamic import 2017-03-20 14:01:50 -07:00
Andy Hanson 2305c10a65 Fix lint errors 2017-03-17 13:54:18 -07:00
Kanchalai Tanglertsampan a77f0d2b1a Do not collect imports in parser as it makes it very hard for incremental parsing 2017-03-16 17:47:10 -07:00
Mohamed Hegazy 3b57b5d4d5 Refactor checking for checkJs value in a common helper 2017-03-15 15:17:33 -07:00
DLehenbauer 3f980bead0 Remove vestiges of WScript support (Issue #14414) 2017-03-10 07:10:58 -08:00
Yui T 827abb3576 Parse import call and use collect its specifier 2017-03-09 22:30:06 -08:00
Mohamed Hegazy fe7719f0a9 Disable check diagnostics per line 2017-03-08 23:18:39 -08:00
Mohamed Hegazy 3d03f8d8a5 Merge branch 'fixBuildBreak' into checkJSFiles 2017-03-08 23:17:28 -08:00
Mohamed Hegazy e9f82145b7 Code review comments 2017-03-08 21:50:23 -08:00
Mohamed Hegazy fb218b7897 Error if --checkJs is used without --allowJs 2017-03-07 14:21:13 -08:00
Mohamed Hegazy 9305d4d99e Change flag name to checkJs 2017-03-07 13:48:37 -08:00
Vladimir Matveev fab4ef0bde cache semantic and declaration diagnostics in program (#14516) 2017-03-07 13:26:41 -08:00
Mohamed Hegazy b015c1d9b0 Allow @check directives to switch on/off checking in a file 2017-03-06 21:39:32 -08:00
Mohamed Hegazy 9f0c5ce141 Add support for //@check directives 2017-03-06 13:50:27 -08:00
Mohamed Hegazy 0b1fff7e66 Add --checkJsFiles 2017-03-06 13:47:27 -08:00
Anders Hejlsberg cda741d14a Introduce --strict compiler option 2017-03-03 10:25:10 -08:00
Ron Buckton 2f624f5df3 Expose transformations as public API 2017-02-07 14:36:15 -08:00
Ron Buckton ff4c72de00 Make most current Node factory functions public 2017-02-01 16:36:10 -08:00
Sheetal Nandi 911511e011 Report option diagnostic in tsconfig.json if possible 2017-01-23 13:16:02 -08:00
Andy Hanson a32914f687 Combine forEachExpectedEmitFile and forEachEmittedFile 2017-01-23 11:14:29 -08:00
Andy Hanson 8886cefe58 Clean up code for getting emitted files 2017-01-20 10:46:15 -08:00
Andy Hanson 932eaa3f90 Rename and consolidate map iteration helpers 2016-12-28 09:16:38 -08:00
Andy Hanson 9e33585a80 Merge branch 'master' into map5 2016-12-27 12:56:05 -08:00
Mohamed Hegazy e4b81d0331 Merge pull request #13006 from SaschaNaz/lintfix
Fix latest tslint errors
2016-12-26 11:24:25 -08:00
Vladimir Matveev 0649c2272c cache per-folder module resolutions during construction of the program (#13030) 2016-12-19 13:48:45 -08:00
Kagami Sascha Rosylight 2a941a7222 inline length 2016-12-20 03:12:35 +09:00
Kagami Sascha Rosylight 27a60e4580 fix linting errors 2016-12-18 15:44:54 +09:00
Andy Hanson b53b5cf4ab Remove the "set" function and use map.set with multiple lines of code if necessary. 2016-12-12 08:42:12 -08:00
Andy Hanson 6b1cc8972d Use native maps when they're available 2016-12-08 06:40:31 -08:00
Vladimir Matveev 9945529875 use location of config file as initial location for automatic type reference inclusion if possible (#12341) 2016-11-18 13:39:11 -08:00
Vladimir Matveev 4c2474463c ports #12237, #12258 and #12259 into master (#12274)
* treat failures to resolve module name as missing packages (#12237)

* added extra check to prevent multiple installation of the same typing, added version field to telemetry event (#12258)

* added extra check to prevent multiple installation of the same typing, added version field to telemetry event

* use ts.version

* switch to execSync to ensure that no install orders are interleaved (#12259)

* Make sure version is public

* Update file with version string for nightly release
2016-11-15 12:53:46 -08:00
Andy Hanson 6c7e1b6913 Merge branch 'master' into symlink3 2016-11-11 13:35:47 -08:00
Andy Hanson b65729e5b2 Merge branch 'master' into common_source_directory 2016-11-11 13:10:29 -08:00
Mohamed Hegazy ea309fe504 Update version (#12162) 2016-11-10 16:30:01 -08:00
Mohamed Hegazy d537b79c61 Merge release-2.1 into master (#12157)
* Update LKG

* Update version

* Update LKG

* Skip overloads with too-short function parameters

If the parameter of an overload is a function and the argument is also a
function, skip the overload if the parameter has fewer arguments than
the argument does. That overload cannot possibly apply, and should not
participate in, for example, contextual typing.

Example:

```ts
interface I {
  (a: number): void;
  (b: string, c): void;
}
declare function f(i: I): void;
f((x, y) => {});
```

This code now skips the first overload instead of considering.

This was a longstanding bug but was only uncovered now that more
functions expressions are context sensitive.

* Test skip overloads w/too-short function params

1. Update changed baseline.
2. Add a new test with baseline.

* Minor style improvements

* Ignore optionality when skipping overloads

* Do not use contextual signatures with too few parameters

* isAritySmaller runs later: getNonGenericSignature

* rewrite void-returning statements in constructors that capture result of super call (#11868)

* rewrite void-returning statements in constructors that capture result of super call

* linter

* Update LKG

* Fix emit inferred type which is a generic type-alias both fully and partially fill type parameters

* Add tests and baselines

* Skip trying to use alias if there is target type

* Update baselines

* Add diagnostics to remind adding tsconfig file for certain external project (#11932)

* Add diagnostics for certain external project

* Show tsconfig suggestion

* fix lint error

* Address pr

* fix comment

* Update error message

* Flag for not overwrite js files by default without generating errors (#11980)

* WIP

* Properly naming things

* refactor

* apply the option to all files and check out options

* Fix typo

* Update LKG

* lockLinter

* use local registry to check if typings package exist (#12014) (#12032)

use local registry to check if typings package exist

* Add test for https://github.com/Microsoft/TypeScript/pull/11980 (#12027)

* add test for the fix for overwrite emitting error

* cr feedback

* enable sending telemetry events to tsserver client (#12034) (#12051)

enable sending telemetry events

* Update LKG

* Reuse subtree transform flags for incrementally parsed nodes (#12088)

* Update LKG

* Update version

* Update LKG

* Do not emit "use strict" when targeting es6 or higher or module kind is es2015 and the file is external module

* Add tests and baselines

* [Release 2.1] fix11754 global augmentation (#12133)

* Exclude global augmentation from module resolution logic

* Address PR: check using string literal instead of NodeFlags.globalAugmentation

* Remove comment
2016-11-10 14:28:34 -08:00
Zhengbo Li 4dc58dde38 Exclude js files in non-configured projects compile-on-save emitting (#12118)
* Exclude js files in non-configured projects CoS emitting

* remove unnecessary method
2016-11-10 14:12:24 -08:00
Vladimir Matveev 3ecb60146b synthesize complete import declaration for tslib (#12151) 2016-11-10 11:57:37 -08:00
Sheetal Nandi c87bce1119 Merge pull request #11978 from Microsoft/errorReportingInJsFile
Report all the js file errors and skip only the nodes that are not allowed in JS file
2016-11-10 10:37:16 -08:00
Sheetal Nandi 2eba10a25b Updated condition for more readability 2016-11-10 09:40:50 -08:00
Sheetal Nandi dd7f00f20b Parse the jsxFactory again in the checker instead of using cached value in the program 2016-11-10 08:54:13 -08:00
Sheetal Nandi 3d6950d023 When emitting use jsx factory entity expression if provided 2016-11-09 16:40:11 -08:00
Sheetal Nandi 06affa6672 Resolve first identifier of the jsxFactory as part of type check 2016-11-09 15:35:54 -08:00
Sheetal Nandi f7bac98948 Verify that jsxFactory is either identifier or qualified name 2016-11-09 14:32:42 -08:00
Sheetal Nandi 4b8a55793a Add support for taking in jsxFactory option and report errors for invalid combinations 2016-11-09 12:23:59 -08:00
Sheetal Nandi 78bb276216 Merge branch 'master' into errorReportingInJsFile 2016-11-09 11:38:11 -08:00
Sheetal Nandi 6456325973 Handle abstract and const modifiers 2016-11-09 10:39:46 -08:00
Andy Hanson 7079d0450e Fix duplicate function error 2016-11-09 09:12:43 -08:00
Andy Hanson d559f7f17d Merge branch 'master' into symlink3 2016-11-09 09:11:25 -08:00
Andy Hanson 9c80909a90 Resolve symlinks for type reference directives too. 2016-11-09 08:08:10 -08:00
Vladimir Matveev 9e3d6efb19 reduce set of files being watched, increase polling interval (#12054) (#12092) 2016-11-07 21:13:11 -08:00
Zhengbo Li 1c004bf317 Port #12027, #11980 and #11932 to master (#12037)
* add test for the fix for overwrite emitting error

* cr feedback
2016-11-03 21:13:41 -07:00
Andy Hanson 2eca0af91b Leave files from node_modules out when calculating getCommonSourceDirectory 2016-11-03 07:50:07 -07:00
Vladimir Matveev ab75ea75d3 module resolution: prefer locally defined ambient modules, reuse resolutions to ambient modules from the old program (#11999)
module resolution: prefer locally defined ambient modules, reuse resolutions to ambient modules from the old program
2016-11-02 14:41:26 -07:00
Sheetal Nandi 06331b57de Report all the js file errors and skip only the nodes that are not allowed in js
Fixes #11800
2016-11-01 13:00:30 -07:00
Sheetal Nandi d896d3f8a9 Add test cases to report errors for decorators in js file 2016-11-01 11:05:09 -07:00
Andy e6f6a5e6f6 Merge pull request #11495 from Microsoft/includes_glob
Implicitly consider an extensionless file in "includes" to be a recursive directory glob
2016-10-31 13:56:10 -07:00
jramsay 980f9fd2a9 Merge pull request #11848 from Microsoft/AddJavaScriptSemanticErrorsToSyntacticErrors
Fix for #11719 - TSServer: JS files should display syntactic errors for TS syntax
2016-10-28 16:49:53 -07:00
Jason Ramsay 43bd2d8747 Changes from CR feedback 2016-10-27 16:38:59 -07:00
Andy Hanson 12f6dcefa1 Revert "Merge pull request #11354 from Microsoft/map4"
This reverts commit adfdae0dc4, reversing
changes made to aad663cebf.
2016-10-27 15:50:21 -07:00
Andy Hanson bcc0807198 Respond to PR comments 2016-10-27 13:14:56 -07:00
Andy Hanson 867093707b Merge branch 'master' into map4 2016-10-27 12:36:50 -07:00
Andy Hanson dec5f4b39a Merge branch 'master' into map4 2016-10-27 12:21:06 -07:00
Andy 231b5ac52d Merge pull request #11891 from Microsoft/jsx_resolution_diagnostic
Fix bug: Return a resolution diagnostic for a `.jsx` import if `--allowJs` is turned off
2016-10-27 12:05:59 -07:00
Andy 6f519d8a27 Merge pull request #11899 from Microsoft/optional_extension
Make `extension` property of `ResolvedModule` optional
2016-10-27 12:05:29 -07:00
Andy Hanson 0f8003fb39 Make extension property of ResolvedModule optional; introduce ResolvedModuleFull interface for when the extension is provided. 2016-10-27 11:35:20 -07:00
Andy a143f9788e Merge pull request #11889 from Microsoft/untyped_imports
Allow untyped imports
2016-10-27 11:32:21 -07:00
Andy f307948af0 Merge pull request #11893 from Microsoft/truthy_enum
Fix bug: We want to test for existence of the enum value, not whether it's non-zero
2016-10-27 09:03:16 -07:00
Andy Hanson 4937d9c8b4 Allow untyped imports 2016-10-27 08:54:19 -07:00
Andy Hanson 4e20882ac0 Fix: test for presence, not absence 2016-10-27 08:43:22 -07:00
Andy Hanson ed82fddb8c Fix bug: We want to test for existence of the enum value, not whether it's non-zero 2016-10-27 08:14:08 -07:00
Andy Hanson 91885266ac Remove a comment about a parameter that no longer exists 2016-10-27 08:09:59 -07:00
Andy Hanson 8448e741c9 Fix bug: Return a resolution diagnostic for a .jsx import if --allowJs is turned off 2016-10-27 08:08:02 -07:00
Andy Hanson c958c47ef5 Merge branch 'master' into map4 2016-10-26 11:05:51 -07:00
Andy Hanson 9130fbd731 Merge branch 'master' into refactor_module_resolution 2016-10-26 08:27:34 -07:00
Andy Hanson 07bb2582b6 Don't require resolvedTsFileName and resolvedJsFileName, just resolvedFileName and extension. Also, change search order to do all TS searching before searching for JS. 2016-10-26 08:13:58 -07:00
Jason Ramsay 1b16c0b94b For JavaScript files, we report semantic errors for using TypeScript-only constructs from within a JavaScript file as syntactic errors. 2016-10-25 18:09:04 -07:00
Vladimir Matveev 7890f63250 use unresolved imports as a source of used typings (#11828) 2016-10-25 15:24:21 -07:00
Andy Hanson 040942f2b2 Merge branch 'master' into includes_glob 2016-10-25 08:19:37 -07:00
Andy Hanson 1b15646c41 Simplify isImplicitGlob test 2016-10-25 08:13:07 -07:00
Ryan Cavanaugh 95670c6251 Perform a useful comparison. Fixes #11805 2016-10-24 10:14:41 -07:00
Andy Hanson 5e7e5421fa Add noop, notImplemented, and notYetImplemented helpers 2016-10-19 14:21:48 -07:00
Andy Hanson a11838215c Merge branch 'master' into map4 2016-10-19 13:16:55 -07:00
Andy Hanson 1d201c1add Merge branch 'master' into refactor_module_resolution 2016-10-19 09:20:45 -07:00
Andy Hanson 7c53a1deb2 Instead of getResolutionOrDiagnostic, use getResolutionDiagnostic and avoid using resolution.resolvedFileName if the diagnostic is defined. 2016-10-18 14:22:43 -07:00
Andy Hanson 7685e6af15 Forbid unused locals/parameters in compiler 2016-10-18 14:00:52 -07:00
Andy Hanson 64e8221a44 Use single concat call instead of repeated calls 2016-10-18 08:18:01 -07:00
Andy Hanson b557211a37 Return both ts and js results from module resolution, and don't have moduleNameResolver responsible for omitting files based on compiler options 2016-10-18 07:09:43 -07:00
Andy Hanson 7292f9f67e Merge branch 'master' into map4 2016-10-17 06:49:53 -07:00
Andrej Baran 17d60d5d8f Merged master into es2017-target 2016-10-15 08:31:22 +02:00
Mohamed Hegazy 2920f82804 Add error reporting for using --noImplicitUseStrict with --options.alwaysStrict 2016-10-13 16:54:09 -07:00
Andrej Baran a500fd9211 Merge branch 'master' into es2017-target 2016-10-13 14:02:54 +02:00
Andrej Baran b871b5353c Favor use of ES2015 instead of ES6 2016-10-13 13:32:00 +02:00
Andy Hanson e8c7224eac Merge branch 'master' into map4 2016-10-12 08:50:49 -07:00
Andy Hanson 14701e3067 Respond to some PR comments 2016-10-11 13:44:20 -07:00
Andy d34916abf8 Merge pull request #11448 from Microsoft/fix_array_condition
Fix array conditional
2016-10-07 10:03:06 -07:00
Andy Hanson a4f610df82 Inline calculation of resolvedPath 2016-10-07 08:41:23 -07:00
Andy Hanson 13a8dc11b0 Fix array conditional 2016-10-07 08:35:13 -07:00
Andy Hanson aadcbcc083 Use native maps when they're available 2016-10-06 13:29:18 -07:00
Vladimir Matveev bf98d23740 check lib command line option when deciding if program structure can be reused 2016-10-06 05:04:45 -07:00
Vladimir Matveev 8dabe33b32 fix linter (#11366) 2016-10-04 14:00:45 -07:00
Vladimir Matveev 3f2e3919b4 revert versions 2016-09-27 23:36:19 -07:00
Vladimir Matveev 833a46c091 merge with origin/master 2016-09-27 10:22:41 -07:00
Kanchalai Tanglertsampan 7fd5699511 Merge branch 'release-2.0' into release-2.0.5 2016-09-14 16:57:59 -07:00
Mohamed Hegazy b6aeaab019 Update version 2016-09-14 13:13:34 -07:00
Andy Hanson 0f51bdbb4f Rename function and use directorySeparator variables 2016-09-14 06:21:07 -07:00
Vladimir Matveev d14183c5a1 merge with origin/release-2.0.5 2016-09-13 15:59:04 -07:00
Andy Hanson 48c67cbdb5 Merge branch 'master' into import_directory 2016-09-13 08:46:49 -07:00
Kanchalai Tanglertsampan 4685646281 Merge branch 'master' of https://github.com/microsoft/TypeScript 2016-09-06 17:14:36 -07:00