Skip to content

Commit

Permalink
GH-2438 B: As a developer I want to use d.ts react definitions (inste…
Browse files Browse the repository at this point in the history
…ad of n4jsd react definitions) (#2452)

* special handling for d.ts Readonly<Z> types delegates to Z

* support @types/react elements

* also index d.ts that have errors

* add some more tests

* better support for react exotic component

* better cache for declaration merging info

* support declaration merging for type hierarchy

* add test case

* two more tests and fixes

* fix NPE

* add test, rename tests

* fix another dts import bug

* support relative imports between d.ts files, add test

* support optional return type ref, and relative import specifiers

* minor changes and fixes

* add two tests

* fix test

* down to 1800 errors in OPR again

* support 'typings' in package.json

* fix unintended merging

* improve test expectation

* add test for inheritance of merged elements

* major refactoring of hierarchy traverser to support merged types

* fix test

* fix test

* small adjustments on React test definitions

* fix performance issue with more caching

* improve error message

* some changes

* update react defs for testing

* improve type ref handling for utility and conditional types

* typo

* add tests

* support TypeScript's typeof and infer

* adjust test

* revert/disable some changes wrt using type defs of react.d.ts

* fix libs

* small optimization

* some fixes

* update node version

* small fix in d.ts grammar and transformation

* improve TypeHierarchyTraverser

* improve N4JSCache

* add comment

* organize imports

* java doc

* small fix

* small performance improvement

* add test

* typo

* bump version due to some improved type checks causing incompatibilities
  • Loading branch information
mmews-n4 authored Jan 16, 2023
1 parent 61463ed commit 9c6b36f
Show file tree
Hide file tree
Showing 127 changed files with 7,678 additions and 3,793 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class NodeTestRunner {
const coverageMap = lib_coverage.createCoverageMap(coverage);
mkdirp(lib_path.dirname(nycCoveragePath));
log("Writing %s", nycCoveragePath);
lib_fs.writeFileSync(nycCoveragePath, JSON.stringify(coverageMap, null, 2), { encoding: "UTF-8" });
lib_fs.writeFileSync(nycCoveragePath, JSON.stringify(coverageMap, null, 2), { BufferEncoding encoding: "utf-8" });

const coverageSummary = lib_coverage.createCoverageSummary();
for (const file of coverageMap.files()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ export public function readJsonFile(path: string): Object+ {
export public function outputTextFile(filePath: string, content: string): void {
const dir = lib_path.dirname(filePath);
mkdirp(dir);
writeFileSync(filePath, content, { encoding: "UTF-8" });
writeFileSync(filePath, content, { BufferEncoding encoding: "utf-8" });
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugins/org.eclipse.n4js.dts/grammar/TypeScriptParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ thisTypeRef
;

queryTypeRef
: 'typeof' propertyAccessExpressionInTypeRef
: 'typeof' (importTypeRef | propertyAccessExpressionInTypeRef)
;

importTypeRef
Expand Down
Loading

0 comments on commit 9c6b36f

Please sign in to comment.