* feat: support error when comparing with object/array literals
* chore: include regexp, function and class literal
* chore: include regexp, function and class literal
* test: update baseline
* fix: baseline
- this currently causes a bug on Windows with mixed path separators
- it returns a POSIX backslash path for __dirname, and then adds a
forward slash from the directorySeparator, causing mixed separators
- TS uses `/` internally and lets the host convert if needed, so
I assume this should be normalized to all forward slashses instead
- example of the bug from my tests:
```
Expected: "D:\\a\\rollup-plugin-typescript2\\rollup-plugin-typescript2\\node_modules\\typescript\\lib\\lib.d.ts"
Received: "D:\\a\\rollup-plugin-typescript2\\rollup-plugin-typescript2\\node_modules\\typescript\\lib/lib.d.ts"
```
- every other use of __dirname in the codebase seems to be normalized
except for this one
- could use normalizeSlashes for this, but I figure combinePaths is
more appropriate since that will handle it and combine properly as
well without any `+ directorySeparator +` stuff
* Allow referencing type-only exports as namespace members in ImportTypes and TypeQueries
* Add extra test case
* ;; -> ;
* undefined -> false
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
This commit updates the type of `RelativeTimeFormatPart` to clarify that
the `unit` prop is always singular, unlike the plural or singular values
that are accepted as inputs.
This also changes `RelativeTimeFormatPart` to be a discriminated
union type because the `unit` prop is only present if the `type` prop's
value is not "literal".
Fixes#46245
* Add a failing test case for contextual type not provided for functions comming from a property with intersection type
* Fixed an issue with contextual type for intersection properties
* Fixed how type of a property of a contextual type is being computed when intersections with indexers are used
* Add JSDoc's @inheritDoc Support for Static Class Members for TypeScript
* use public api
* fix
* add tests
* simplify implementation
* extract comments from inherticDoc
* Allow export map entries to remap back to input files for a program
* Fix file casing issues on windows
* Implement abiguity error, doesnt quite work
* Refine selection logic in error case to use getCommonSourceDirectory, add more tests
* No error on toplevel return in JS
Turns out it's only an error in modules.
It's possible to keep this error on the list of "OK for JS" errors and
make the checker code stop issuing it for JS scripts only. However, I
don't think the error is valuable enough to do that.
Fixes#48224
* Restore 'return' statement.
* Update Baselines and/or Applied Lint Fixes
* Re-add missing baselines
* No error in toplevel script files
Only issue "no top-level return" error for modules, not scripts,
regardless of whether it's TS or JS.
* Keep Disallowing return in ambient locations
* Allow toplevel return only in non-ESM JS files
* Add test of toplevel return in JS script
* Revert "Add test of toplevel return in JS script"
This reverts commit 2a6dec475a35ec104915000984ffb79452cb7350.
* Revert "Allow toplevel return only in non-ESM JS files"
This reverts commit 6291ae3ba2df305d287f02223d634e21808fd15a.
* Revert "Keep Disallowing return in ambient locations"
This reverts commit 714ea8e524ff1129d94679df78f7790534222980.
* Revert "No error in toplevel script files"
This reverts commit 2056e13d5294a4d923b3f7c8e43dbc72f595afc6.
* restore orphaned baseline
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
* Skip ambient modules in globalThis
Previously, globalThis mistakenly included ambient modules, even though
these are not values:
```ts
declare module "ambientModule" {
export type typ = 1
export var val: typ
}
type Oops = (typeof globalThis)[\"ambientModule\"]
```
This PR adds ambient modules to the kinds of things that are skipped
when constructing `globalThis`' properties, along with block-scoped
variables.
* Skip only modules with every declaration ambient
The modules are required to have at least one declaration so that our
treatment of `globalThis` stays the same, and
`globalThis.globalThis.globalThis` remains legal.