* feat(37782): add quick-fix action to declare a private method for names that start from underscore
* better merge order in messages json
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Allowed comment directives to be multiline
* Added tests, and perhaps fixed a test runner bug?
* I think it's going to need a consistent variable to loop over
* Used dynamically computed indexes in verifies
* Added multiline tests
* Increased flexibility for multiline comment parsing
* Undid a couple of formatting changes; removed backslashes from multiline regexp
* Added baseline tests for multiline comment skipping
Co-authored-by: Orta Therox <orta.therox@gmail.com>
* Fix `updateBinary` `operator` parameter
There is an issue in `updateBinary` where attempting to update
`operator` without updating `left` or `right` results in a silent no-op.
* Use defaulted parameter in `updateBinary`
* Adds support for looking up past Blocks in expando objects
* Adds JS tests to validate the JS parsing also works
* Get the top level block expando tests green
* Shared early couldContainTypeVariables check in instantiateType
* Defer creation of map object in createUnionOrIntersectionProperty
* Types with top-level non-generic type alias reference no type variables
* Use CFA to determine types of properties declared by this.xxx assignments
* Accept new baselines
* Also use CFA in constructor functions
* Accept new baselines
* Fix lint error
* Only widen fresh literal types in CFA of assignment to auto-typed
* Auto-typing for declared properties with no type annotation or initializer
* Add optionality if declaration includes '?' modifier
* Always use CFA for properties with no initializer in .js files
* Small fix
It's always supposed to have been this way, but I was worried about how
breaky the change would be when adding globalThisType. This PR is
experiment to see how much.
Fixes#35882 maybe
initialiser. But this is only correct when the initialiser is for a
parameter. For example:
```ts
declare let x: { s: string } | undefined;
const { s } = x;
```
This PR removes undefined from the type of a binding pattern only when
the binding pattern's parent is a parameter. This fixes the regression
from 3.8. However, it's still not the ideal fix; we should be able to
use control flow to solve this problem. Consider:
```ts
const { s }: { s: string } | undefined = { s: 'hi' }
declare function f({ s }: { s: string } | undefined = { s: 'hi' }): void
```
Neither line should have an error, but the first does in 3.8 and after
this change.
* Remove superCallShouldBeFirst error
It seems redundant since TS gives an error on any use of `this` before
super, and non-`this` uses before `super` should be fine.
Fixes#37371
* Revert "Remove superCallShouldBeFirst error"
This reverts commit 3c09153c8a.
* error except for target:"esnext" && useDefineForClassFields
* Fix use-before-def with methods on esnext+useDefineForClassFields
It was incorrectly flagging methods as used before their definition, but
this is allowed under any emit.
* Add instance function test case
* Propagate nonInferrableType in &&, || and ?? operators
* Add regression test
* Simpler solution: getTypeFacts(neverType) should return TypeFacts.None
* Add fastpath to isRelatedTo for type references
* Do not check intersections or unions to ignore propegating reference flags, properly set comparing jsx flag
* Re-remove unneeded check
* Just check for TypeFlags.Object
* Remove else clause
* Error on missing BigInt in ES2020 too.
Previously it was only on ESNext, but bigint ships in ES 2020.
There are no tests for this; passing `false` doesn't cause any tests to
fail at least.
* add tests
* Avoid circular reference in this-property assignments
To do this, don't check this-property assigments that have the
this-property of the lhs appearing somewhere on the rhs:
```js
class C {
m() {
this.x = 12
this.x = this.x + this.y
}
}
```
I tried suppressing the circularity error, but because we cache the
first type discovered for a property, this still results in an implicit
any for `x` in the previous example. It just doesn't have an error.
Fixes#35099
* Add test case + rename function
* Use isMatchingReference
This fixes two bugs in the parseJSDocCommentWorker().
1. The initial indent was calculated wrongly. It was set to the
difference between the index of the last newline or beginning of file
and the current start marker (position of /**). By calculating it
this way, the newline character itself is counted as indentation
character as well. The initial indent is used as margin for the
whole comment. The margin contains the amount of characters to skip
before the actual content or payload of a comment line. The algorithm
does not skip non-whitespace characters at the beginning of the
content, but it would strip away one whitespace character for
indented content (which does matter, if there is e.g. a Markdown
code block with indentation in the comment).
2. When reducing initial whitespace sequences of comment lines by the
remaining margin the algorithm cut off one character too much. This
might have been introduced to fix 1. It had a similar effect as 1.
Previously this was only an error when useDefineForClassFields: true,
but now it's an error for all code. This is a rare mistake to make, and
usually only occurs in code written before `readonly` was available.
Codefix to come in subsequent commits.
Get the `declaration` container just once instead of in three places.
(Minor change: one place used to start looking from
`declaration.parent`, but that shouldn't make any difference.) Also,
don't pass it to the helper functions since they're local anyway.
This only applies in JS, where `@template` tags can apply to
initialisers of variable declarations:
```js
/**
* @template T
* @returns {(b: T) => T}
*/
const seq = a => b => b
```
Fixes#36201
* Consolidated extra property check with intersections
* Fix comment
* Add tests
* Properly propagate intersectionState
* Route property check through recursive type tracking logic
* Accept new baselines
* Skip check when apparent type of source is never
* Accept new baselines
* Only check when apparent type of source is a structured type
* Fix serialisation of static class members in JS
Previously static class members would be treated the same way as expando
namespace assignments to a class:
```ts
class C {
static get x() { return 1 }
}
C.y = 12
```
This PR adds a syntactic check to the static/namespace filter that
treats symbols whose valueDeclaration.parent is a class as statics.
Fixes#37289
* fix messed-up indent
* Extract function
* Fix crash for private identifier in expando assignments
It does this by disallowing private identifiers from expando assignments
entirely. I haven't thought of a scenario where they make sense, but I
haven't thought about it exhaustively either.
Fixes#37356
* Update baselines
I think the new error is probably better. It's certainly different!
* Elaborate on reasons for 'never' intersections
* Accept new API baselines
* Accept new baselines
* Add tests
* Accept new baselines
* Address CR feedback
Previously, spreading an optional any gave a bogus error when the name
conflicted with earlier properties in the object literal. Now the code
checks any types for optionality before issuing the error.
Fixes#37740
* stash
* add surmise for return type
* add support for more case
* add more test case
* add more testcase and fix all test
* fix changed diagnosis
* fix broken test case
* add more case
* rename quickfix
* fix conflict
* fix fix desc
* fix semi
* Avoid replace brace with paren
* Split fix all action
* Add return work in same line
* fix test cases
* rename baseline
* refactor and handle comment
* Support semi
* make helper internal
* Accept change
* Accept the huge set of ever so slightly changed baselines
* Update return type logic to only reuse nodes if original nodes share scope with current node, like property types, only reuse nodes if symbols referened are acessible, reuse nodes for property signatures, too
* Only reuse nodes when a context is provided (otherwise identifier printback may fail)
* Only track symbol if symbol is found and no error is recorded
* Fix type parameter reuse lookup
* Forbid cjs module.exports references in retained nodes
* Adjust check for cjs export references to not include bad module type in output
* Add symbol to all identifiers we see in existing nodes for quickinfo
* Accept fourslash baseline updates
* Accept slightly updated baseline post-merge
* Do not copy original nodes for error types, replace empty type references with any
* Explicitly merge module augmentation members into the exports added by export * declarations
* Use ?., add namespace merge test
* Add missing merged symbol call to handle enum/ns merges during entity name lookup
* Add test with error case
* Handle missing value declarations in more places, unify duplicate declaration error handling to improve assignment declaration duplicate errors
* Fix crash on bad namespace parse
`global` inside a class body is parsed as a module declaration, and in
the following example has no body:
```ts
class C {
global x
}
```
`x` is parsed as a separate ExpressionStatement. This caused a crash in
emit because the code didn't expect a module declaration with no body.
* inline node.body variable
* fix missed references to body
Extends the fix of #36108 so that the simple example gets correct emit;
the complex test case I came up with still doesn't work correctly, but
the actual code froma #35228 is fixed.
* Special-case window, self, global, globalThis methods
* Disambiguate global and this property completions in details requests
* Hide the Map<boolean> implementation
* Update old tests
* Replace SymbolOriginKind stringification with dedicated enum
* Make never rest type top-like
* Add higher-order test
* properly support types which reduce to never
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* Add Advanced Compile Options to --init command
* removed advanced options and descriptioncolumn
* tests: fix tsconfig.json baselines
* tests: fix failing tests
* feat: adjusted link to specification
* fix: removed duplicate increment flag
* chore: moved position back
* return of the comments
* fix for missalignment
* return of the comment
* New diagnostic message for wrong JSX function component
* Component and Mixed type
* fix existing tests
* add new test for JSX component return type error
* fix tslint error
* update diagnostic message to include component name
* accept baseline
* update tests
* missing semicolon
* accept baseline
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* Add test case that shows failure to handle commentDirectives in incremental parsing
Testcase for #37536
* Handle comment directives in incremental parsing
Fixes#37536
* Add test case when the errors are not refreshed if global file is deleted
Testcase for #36728
* When the global file is deleted mark all files as changed
Fixes#36728
* Update other baselines to fix file info
* Sort the arrays of fileNames in the build info
Earlier we did this in testing to ensure we could baseline now moved to actual build info writing
Fixes#37156
* Sort using compareStringsCaseSensitive
* Enhancement new expression with type arguments without parenthesized argument list error message
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
* add baselines
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
* use parseErrorAt
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
* refine code
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
* Space before paren
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* fix: hyphened name not auto-completed by the ls
* fix: accept new baseline
* Adds a test to validate the hypened identifiers in JSX
Co-authored-by: Orta Therox <orta.therox@gmail.com>
* Add the 'awaited' type operator
* Add script to manually add reviewers to a PR when GH 'Suggested Reviewers' breaks
* Fix lint error in review script
* Only defer generic awaited type for possible thenable
* Add variance-like behavior for awaited
* Switch awaited type params to 'unreliable' variance
* fix typo in inferTypes
* LKG without syntax in lib
* LKG with new syntax in lib
* Add 'strictAwaitedTypes' flag
* Treat strictAwaitedTypes as strict-mode flag
* Rename TAll, remove duplicate definition of 'race'
* Apply suggestions from code review
Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
* Fix inference priority
* Update comment to isGenericAwaitableType
* Add overloads for then/catch to Promise
* Add inference heuristic for T | PromiseLike<T> (for any PromiseLike)
* Remove strictAwaitedTypes flag
Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
* Add test that calling getAffectedFiles on two different files (even if the second one is saved) returns all files
* If emitting declaration file, update the d.ts signature in state to not have to save all files when different file changes without changing its shape
Fixes#30508
* Add test for project reference and auto import
Test for #34677
* Add project reference redirect to the possible file name to import if file is source of project reference redirect
Fixes the auto import suggestion when project is built
* Use fileExists that mimics presence of project reference redirect file when trying to get auto import file name
* Improve jsx tag error span
* Move solution to parseJsxChild func
* Add tests and update baselines
* Update comment in src/compiler/parser.ts
Co-Authored-By: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Use skipTrivia to check for whitespaces and other trivia
* Import React into errorSpanForUnclosedJsxTag.tsx
* .
* .
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Allow emitter to write multiple newlines in node lists
* Progress
* Progress
* Fix recomputeIndentation
* Add tests, fix leading line terminator count
* Do a bit less work when `preserveNewlines` is off
* Fix accidental find/replace rename
* Restore some monomorphism
* Fix single line writer
* Fix other writers
* Revert "Fix other writers"
This reverts commit 21b0cb8f3b.
* Revert "Fix single line writer"
This reverts commit e535e279f9.
* Revert "Restore some monomorphism"
This reverts commit e3ef42743a.
* Add equal position optimization to getLinesBetweenRangeEndAndRangeStart
* Add one more test
* Actually save the test file
* Rename preserveNewlines to preserveSourceNewlines
* Make ignoreSourceNewlines internal
* Optimize lines-between functions
* Add comment;
* Fix trailing line terminator count bug for function parameters
* Preserve newlines around parenthesized expressions
* Back to speculative microoptimizations, yay
* Don’t call getEffectiveLines during tsc emit at all
* Convert symlink scenarios to virtual FS where its symlinks are correctly maintained
Adds test for #36866
* Fix the casing issue when redirects differ in casing of the file
* Make ModuleSpecifierResolutionHost internal
* Refactoring for ModuleSpecifierResolutionHost
* If any of the file path option is from node_modules folder, consider only paths in node_modules folder
* Update src/services/utilities.ts
Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
* Add codefix for --noImplicitThis
* Code review
* Back to building post-merge
* Remove redundant functions + update tests
Infer-from-usage also inserts `this: any` parameters when needed, so I
removed that from fixImplicitThis.
Otherwise, fixImplicitThis has better suggestions than inferFromUsage,
so I moved inferFromUsage later in the suggestion order.
* More redundancy removal
Don't need to add `@this` anymore either since inferFromUsage will do
that.
* More baseline updates
From moving inferFromUsage down in priority I think?
* remove now-redundant ad-hoc jsdoc emit
* fix more bad merge
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Flatten immediately nested conditional types in the false position
* Add test
* Accept new baselines
* Handle nested distributive types with different checkType
* Allow deeply nested immediately resolving conditionals without any syntactic requirements or implementation contortions
Extract logic into function
Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
* Add tests that fail because of symlink to non common directory node_modules
* When the imported module is through node_modules and symlink to folder that isnt node_modules
Most of the monorepo like scenarios are like this so looking at symlink to decide if file can be imported is essential
Fixes#28689
* Treat intersections of only objects as a single object in relations
* Exclude intersections containing non-inferrable types
* Accept new baselines
* Update test
* Accept new baselines
* Add tests
* getPropertiesOfUnionOrIntersectionType: handle types with index signature
Fixes: #31565
* fix test
* more testing
* fix typo in checker.ts
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Make substitution types even if the substitution base isnt a type variable
* Broaden usage of getConditionalFlowTypeOfType to _all_ type lookups
* Align comments
* Treat write-only-access to a class member with setter as a reference.
* Add test case for unused private members, special-casing the member with a setter.
* Make the systems for baselining default to pretty
* Ensure that we have seenAffectedFiles map when files are added to pending emit because they were present in the old state
This happens in build scenarios since semantic diagnostics are queried before emit and hence files are added to seenAffectedFiles pending emit
Fixes#37269
This addresses issue #28975
(https://github.com/microsoft/TypeScript/issues/28975).
When providing a value as a type argument, we can suggest a more specific
error message: "Did you mean to use typeof T?"
adds error message
WIP: Detect error
WIP: progress
updated tests
janky implementation
adds test coverage around literal types being unaffected
refactor out isIdentifierATypeArgument function
adds test case for type alias
adds test case for nested type arguments
fixes linting errors
merge master into branch to overwrite changes
changes value as type error message
This suggests 'typeof T' as a potential alternative when we give an error
about using value T as a type.
remove stale tests from old change
Co-authored-by: John Patterson <john@johnppatterson.com>
* Use objects instead of closures for type mappers
* Flatten combined type mappers
* Single point of creation for type mappers
* More optimizations
* Fix lint error
* Fewer symbol instantiations / discard type mapper after instantiation
* More optimizations
* Simplify mapper layout and cache in composite mappers
* Removing cache as it doesn't seem to matter much
* Get rid of identityMapper
* Implement constructor type guard
* Fix code review issues for constructor type guard.
- Do not limit constructor expression to only identifiers
- Fix `assumeTrue` and operator no-narrow check
- Use better way to check that identifier type is a function
- Loosen restriction on what expr is left of ".constructor"
- Update typeGuardConstructorClassAndNumber test to include else cases
* Fix grammar & spacing in `narrowTypeByConstructor`
* fix bad merge
* switch (back?) to crlf
* update baselines
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Using a constructor function like this can help node better optimize
object allocation. This improves memory usage when compiling
`src/compiler` from **277M** to **270M**, a nice ~3% win.
As stated in 26417, `host` is only ever written to and never read from. `createProgramHost` is the only place I could find that provides a member for `ProgramHost`'s `onCachedDirectoryStructureHostCreate`, so that's removed as well.
* Allow passing watch to the change as parameter
* Reset hasChangedAutomaticTypeDirectiveNames once new program is created
Also dont invoke afterProgramCreate if the program is not new
* Added @ts-expect-error to @ts-ignore directives
Similar to `// @ts-ignore`, but will itself cause a new error diagnostic if it does not cause an existing diagnostic to be ignored.
Technical summary:
1. The scanner will now keep track of `CommentDirective`s it comes across: both `@ts-expect-error` and `@ts-ignore`
2. During type checking, the program will turn those directives into a map keying them by line number
3. For each diagnostic, if it's preceded by a directive, that directive is marked as "used"
4. All `@ts-expect-error` directives not marked as used generate a new diagnostic error
* Renamed to getDiagnosticsWithPrecedingDirectives per suggestion
* Added JSDoc comment I thought I did already
Co-authored-by: Orta <orta.therox+github@gmail.com>
Use `emit()` for writing `questionDotToken`, leading to properly calling
the emit hooks (which `emitTokenWithComment` doesn't) and printing the
comments. This fixes#35372 by calling its hooks to set the `.__pos`
and `.__end` fields.
Also, remove `getDotOrQuestionDotToken` which was used only here --
mainly because it seems likely to encourage misusing the
`questionDotToken` again.
Also, fix a bunch of `visitor` -> `tokenVisiton` calls in
`visitorPublic.ts`.
* More precise property-overwritten-by-spread errors
Trying to do this check in getSpreadType just doesn't have enough
information, so I moved it to checkObjectLiteral, which is a better
place for issuing errors anyway.
Unfortunately, the approach is kind of expensive in that it
1. creates a new map for each property and
2. iterates over all properties of the spread type, even if it's a
union.
I have some ideas to improve (1) that might work out. I'm not sure how
bad (2) is since we're going to iterate over all properties of all
constituents of a union.
Fixes#36779
* another test and rename
* Reinterpret a type parameter constrained to any as an upper bound constraint
* Use real constraqint in alias in test
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Optionally stop looking for the default configured project at
node_modules
* Make stopping at node_modules non-optional
* Generalize and simplify the change - node_modules files don't have default configured projects
* Remove bogus @implements errors
Make the search for the actual host more comprehensive by reusing the
code that previously only searched for functions. I don't know what to
call this function now, since the old name wasn't accurate either.
* undo gratuitous name change
* Improve name and make calling more uniform
It's slightly less efficient but I think worthwhile for readability.
* Treat never-like intersections as never
* Accept new baselines
* Fix compiler issues revealed by increased intersection correctness
* Delete fourslash tests that are no longer applicable
* Include isNeverLikeIntersection check in getNormalizedType
* Erase never-like types in several more places
* Check that base types are not never-like
* Add comments
* Revert isNeverLikeType check in getIndexType (keyof shouldn't resolve member types)
* Introduce getReducedType for union and intersection types
* Don't reduce in getApparentType
* Avoid relationship check in resolveMappedTypeMembers
* Accept new baselines
* Don't call getReducedType in getIndexType
* Ensure reduced and unreduced forms of a type can compare identical
* Reduce types before converting them to string representation
* Accept new baselines
* Reduce intersections before obtaining keyof X
* Add tests
* Accept new baselines
* Fix comment in tests
* Don't infer from empty intersection types
* Add tests
* Accept new baselines
* Defer instantiation of mapped type property types
* Accept new baselines
* Include more precise type in diagnostic
* Accept new baselines
* Minor optimization
* Improve error message
* Optional properties in intersections are never discriminants
* Hoist initial assignment to exported names in cjs to they are not blocked by bindings made by __exportStar
* Copy hoisted identifiers so they do not create sourcemaps
* Accept updated baselines
* Exempt ambient [#]private from unused error
These declarations exist to create nominality so they _must_ be unused.
There should be no error for them.
* Switch to fourslash test
I don't know how to baseline suggestion diagnostics in the compiler
tests.
* Adding support for @implements.
* Fixed code review issues for @implements, added some more tests.
* Fixed declaration emit for @interface
* Improved getImplementsTypes to not cache the results since it is only used once.
* Removed unnecessary checks from getImplementsTypes
* Add tests for specifying composite as command line option
* Allow passing --composite false on commandline
* Add test to verify tsc --composite false from command line
* Handle "undefined" as option value to be set to undefined for that option
* Support "null" as option to be converted to undefined which is normally end result from our config file as well
* Support null as option for any tsconfig only option as well, and dont support undefined
* Fix public api test case
* Validates objects instead of stringify result
* Add composite true to base source
No error on `this` expressions in static property declaration
initialisers when targetting ESNext and with useDefineForClassFields. In
this case the emit is correct and the types are correct, so the error
should not be issued.
* Emit an export assignment even when the initializer is elided
* User a void 0; and elide assignments for enum/namespace-sourced exported variables
* HAHA, SIMPLIFY GREATLY
* Unwrap substitutions both before _and_ after potential simplification
* Repeatedly unwrap/simplify until no more can be performed
* Use seperate loops for source and target to reduce redundant calls
* Move loop into function
* Inline worker
* Properly handle control flows from returns in try/catch within IIFE
* Accept new baselines
* Add tests
* Accept new baselines
* When end of finally is unreachable, end of try statement is too
* Add additional test case
* Fix tests when there are project references but has disableSourceOfProjectReferenceRedirect
* Handle getScriptVersion correctly to ensure program structure is checked correctly
Fixes#36748
* Harness's language service host doesnt have getProjectVersion.
This means earlier we were creating fresh program everytime we did LS operation
Now we reuse same program, so quick info depends on order of quickinfo demands
* Because same program is used, it unvails a bug that if `export=` is evaluated before finding references, it cant find all definitions from the merge
* Update src/server/project.ts
Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Make clearSourceMapperCache required
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
THe code to bind `@enum` and `@typedef` didn't handle the case that the
`@enum` was on a property assignment to an alias of module.exports.
Specifically, `x` needs to be correctly aliased to the file's symbol in
the example below:
```
var x = module.exports = {};
/** @enum {string} */
x.E = {
A: "A"
};
```
* use getters to define live export bindings
* fix scoping in export* helper
* Object.defineProperty cannot be used in ES3 target
* Accept changed baselines
* Use function expression, not arrow function
* Update importStarHelper to match export helper in binding-making
* Fix whitespace
* Adjust whitespace in edited helpers
* Use new helper for setting bindings, use unscoped __exportStar helper for exports so helpers get reused more
* Accept updated baselines
* Use __createBinding for individual reexports when target is es3
* Remove unneeded type assertion
* Singeline the helpers
* Add check for createBinding helper, accept updated baselines with shortened helper
Co-authored-by: Michael Rawlings <mirawlings@ebay.com>
JSDocNamepaths span a lot of identifiers that we don't actually care
about, so it's incorrect for createChildren to add its children as
synthetic nodes.
* Add test
* Fix superfluous error when destructuring from object that includes spread assignment
* Update baseline to include error case
* Remove redundant check
* Always wrap classes with decorators or static properties in an IIFE
Currently only script targets less than or equal to ES5 will wrap classes. However, the wrapping is also crucial to file size optimizations for ES2015+ as well. Without the IIFE wrapper, minification tools do not elide the class. This is due to references to the class being present within the downlevelled decorator and static property code.
This change represents the full completion of issue #15857
* Accept new baselines
* getCandidateForOverloadFailure:call resolveUntypedCall
This re-adds the missed errors and marks as used missed nodes from the
user and RWC baselines.
* Update baselines and remove new test
It was redundant with the old tests
* Defer resolveUntypedCall on resolution failure to give priority to parameter types fixed by overload signatures
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* 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
* Fix jsdoc comment parsing initial state
Jsdoc comment parsing can be invoked in two modes:
1. top-level parsing, for comments not inside a tag.
2. tag parsing, for comment that occur after the semantic parts of a
tag.
Top-level parsing skips an initial * because it assumes that it is starting
at the very beginning of a JSDoc comment. Tag parsing does not.
The two modes are distinguished by an optional second parameter named
`margin`. When `margin` is provided, it provides an initial indent used
for comment alignment.
Previously, the check for `margin` was a truthy check `if (margin)`.
This check incorrectly treats `margin=""` the same as
`margin=undefined`.
This PR changes the check to `if (margin !== undefined)`, which
correctly treats `margin=""` the same as `margin=" "`.
* Fixes for broken tests
1. Use SawAsterisk start state.
2. @template needs to skip asterisk in addition to whitespace while
parsing type parameter names.
* undo code move
* Improve reasoning about when to create deferred type references
* Accept new baselines
* Fix minor issues
* Handle default type arguments case in isDeferredTypeReferenceNode
Exposes `hasOnlyExpressionInitializer` as a public function so users of
TypeScript compiler APIs do not have to roll their own
`HasExpressionInitializer` type guards.
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* WIP on making the JSX text node not include whitespace
* Scans to the last newline for JSX correctly
* Handle JSX closing element wrapping
* Offload all jsx text indentation handling to indentMultilineCommentOrJsxText
* Switch from find node -> find inde in formatting
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* Conditionally elide a parameter from contextual type signature calculation
* Slightly different approach to forbid inference to specific expressions
* Handle nested literals and mapped types correctly
* Delete unused cache
* Rename ContextFlags.BaseConstraint and related usage
* Add tests from my PR
* Update ContextFlags comment
Co-Authored-By: Wesley Wigham <wwigham@gmail.com>
* Update comments and fourslash triple slash refs
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* Add test case to verify directory casing preservation when watching
* Fix unicode file name handling when watching failed lookup locations
* Add special file name lower conversion routine and use that instead of toLowerCase
Fixes#31819 and #35559
* Remove unicode from code
* Replace toLocaleLowerCase on filenames with ts.toFileNameLowerCase
* Make the intent of using toFileNameLowerCase more clear and why we make the restriction on turkish I with dot on top of it
* Update baselines for newly added tests in master
* Refactor the test
* Add tests for syntax errors in tsconfig not being reported
* Report config file parsing diagnostics correctly
Fixes#36515
* Fix errors in existing tests for unintended tsconfig parse errors
* Fix lint