Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve internal JSDoc types #4173

Merged
merged 12 commits into from
Oct 27, 2023
Merged

Improve internal JSDoc types #4173

merged 12 commits into from
Oct 27, 2023

Conversation

andrewiggins
Copy link
Member

This PR improves the internal JSDoc types of the core source. It puts all internal types into the global namespace so you no longer need to do import('../internal') in the core source files as well as adds some additional JSDoc and ts-expect-error to improve typing.

I've added a "tsc" script that runs the TypeScript type checker against the core source files to validate their types. I don't know if we want to keep this as a merge check, but figured we'd give it a shot.

@github-actions
Copy link

github-actions bot commented Oct 27, 2023

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -3% - +4% (-5.56ms - +6.40ms)
    preact-local vs preact-main
  • 03_update10th1k_x16: unsure 🔍 -4% - +4% (-1.46ms - +1.35ms)
    preact-local vs preact-main
  • 07_create10k: unsure 🔍 -1% - +1% (-15.72ms - +16.63ms)
    preact-local vs preact-main
  • filter_list: unsure 🔍 -3% - +3% (-0.99ms - +0.89ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +1% (-1.38ms - +0.70ms)
    preact-local vs preact-main
  • many_updates: unsure 🔍 -1% - +7% (-0.17ms - +1.47ms)
    preact-local vs preact-main
  • text_update: faster ✔ 2% - 13% (0.07ms - 0.53ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +1% (-0.15ms - +0.22ms)
    preact-local vs preact-main

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-main
  • 03_update10th1k_x16: unsure 🔍 -0% - +0% (-0.00ms - +0.01ms)
    preact-local vs preact-main
  • 07_create10k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • filter_list: unsure 🔍 -1% - +2% (-0.02ms - +0.02ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-main
  • many_updates: unsure 🔍 -1% - +1% (-0.02ms - +0.02ms)
    preact-local vs preact-main
  • text_update: unsure 🔍 -2% - +4% (-0.01ms - +0.03ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main

Results

02_replace1k

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main161.80ms - 171.14ms-unsure 🔍
-4% - +3%
-6.40ms - +5.56ms
slower ❌
0% - 7%
0.08ms - 11.47ms
preact-local163.16ms - 170.62msunsure 🔍
-3% - +4%
-5.56ms - +6.40ms
-slower ❌
1% - 7%
1.25ms - 11.15ms
preact-hooks157.44ms - 163.95msfaster ✔
0% - 7%
0.08ms - 11.47ms
faster ✔
1% - 7%
1.25ms - 11.15ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main3.30ms - 3.32ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
0% - 1%
0.02ms - 0.05ms
preact-local3.31ms - 3.32msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
1% - 1%
0.02ms - 0.05ms
preact-hooks3.33ms - 3.36msslower ❌
0% - 1%
0.02ms - 0.05ms
slower ❌
1% - 1%
0.02ms - 0.05ms
-

run-warmup-0

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main58.43ms - 62.70ms-unsure 🔍
-3% - +6%
-1.52ms - +3.82ms
unsure 🔍
-6% - +4%
-3.43ms - +2.49ms
preact-local57.81ms - 61.03msunsure 🔍
-6% - +2%
-3.82ms - +1.52ms
-unsure 🔍
-7% - +2%
-4.22ms - +1.00ms
preact-hooks58.98ms - 63.09msunsure 🔍
-4% - +6%
-2.49ms - +3.43ms
unsure 🔍
-2% - +7%
-1.00ms - +4.22ms
-

run-warmup-1

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main69.62ms - 73.00ms-unsure 🔍
-5% - +2%
-3.30ms - +1.21ms
faster ✔
2% - 9%
1.63ms - 6.53ms
preact-local70.86ms - 73.85msunsure 🔍
-2% - +5%
-1.21ms - +3.30ms
-faster ✔
1% - 7%
0.71ms - 5.35ms
preact-hooks73.62ms - 77.16msslower ❌
2% - 9%
1.63ms - 6.53ms
slower ❌
1% - 7%
0.71ms - 5.35ms
-

run-warmup-2

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main65.15ms - 68.18ms-unsure 🔍
-1% - +6%
-0.68ms - +3.71ms
faster ✔
1% - 7%
0.53ms - 4.90ms
preact-local63.56ms - 66.74msunsure 🔍
-6% - +1%
-3.71ms - +0.68ms
-faster ✔
3% - 9%
1.99ms - 6.46ms
preact-hooks67.80ms - 70.95msslower ❌
1% - 7%
0.53ms - 4.90ms
slower ❌
3% - 10%
1.99ms - 6.46ms
-

run-warmup-3

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main55.41ms - 57.88ms-unsure 🔍
-1% - +5%
-0.49ms - +2.60ms
unsure 🔍
-5% - +1%
-2.90ms - +0.64ms
preact-local54.66ms - 56.51msunsure 🔍
-5% - +1%
-2.60ms - +0.49ms
-faster ✔
1% - 6%
0.62ms - 3.75ms
preact-hooks56.51ms - 59.04msunsure 🔍
-1% - +5%
-0.64ms - +2.90ms
slower ❌
1% - 7%
0.62ms - 3.75ms
-

run-warmup-4

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main76.25ms - 82.16ms-unsure 🔍
-2% - +9%
-1.34ms - +7.15ms
faster ✔
4% - 14%
3.69ms - 12.41ms
preact-local73.26ms - 79.35msunsure 🔍
-9% - +2%
-7.15ms - +1.34ms
-faster ✔
8% - 17%
6.53ms - 15.38ms
preact-hooks84.05ms - 90.47msslower ❌
4% - 16%
3.69ms - 12.41ms
slower ❌
8% - 21%
6.53ms - 15.38ms
-

run-final

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main52.76ms - 58.89ms-unsure 🔍
-6% - +9%
-3.08ms - +4.93ms
slower ❌
0% - 13%
0.18ms - 6.90ms
preact-local52.33ms - 57.47msunsure 🔍
-9% - +5%
-4.93ms - +3.08ms
-unsure 🔍
-1% - +11%
-0.30ms - +5.53ms
preact-hooks50.92ms - 53.65msfaster ✔
1% - 12%
0.18ms - 6.90ms
unsure 🔍
-10% - +0%
-5.53ms - +0.30ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main33.52ms - 35.58ms-unsure 🔍
-4% - +4%
-1.35ms - +1.46ms
unsure 🔍
-6% - +2%
-1.99ms - +0.82ms
preact-local33.55ms - 35.45msunsure 🔍
-4% - +4%
-1.46ms - +1.35ms
-unsure 🔍
-6% - +2%
-1.98ms - +0.71ms
preact-hooks34.19ms - 36.08msunsure 🔍
-2% - +6%
-0.82ms - +1.99ms
unsure 🔍
-2% - +6%
-0.71ms - +1.98ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main3.27ms - 3.28ms-unsure 🔍
-0% - +0%
-0.01ms - +0.00ms
faster ✔
1% - 1%
0.02ms - 0.03ms
preact-local3.27ms - 3.28msunsure 🔍
-0% - +0%
-0.00ms - +0.01ms
-faster ✔
0% - 1%
0.01ms - 0.03ms
preact-hooks3.29ms - 3.30msslower ❌
1% - 1%
0.02ms - 0.03ms
slower ❌
0% - 1%
0.01ms - 0.03ms
-
07_create10k

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main1340.88ms - 1364.24ms-unsure 🔍
-1% - +1%
-16.63ms - +15.72ms
unsure 🔍
-1% - +1%
-19.10ms - +13.53ms
preact-local1341.83ms - 1364.20msunsure 🔍
-1% - +1%
-15.72ms - +16.63ms
-unsure 🔍
-1% - +1%
-18.29ms - +13.63ms
preact-hooks1343.96ms - 1366.73msunsure 🔍
-1% - +1%
-13.53ms - +19.10ms
unsure 🔍
-1% - +1%
-13.63ms - +18.29ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main26.31ms - 26.32ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-local26.31ms - 26.32msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-hooks26.34ms - 26.34msunsure 🔍
+0% - +0%
+0.02ms - +0.02ms
unsure 🔍
+0% - +0%
+0.02ms - +0.02ms
-
filter_list

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main28.81ms - 30.14ms-unsure 🔍
-3% - +3%
-0.89ms - +0.99ms
unsure 🔍
-3% - +3%
-0.94ms - +0.98ms
preact-local28.76ms - 30.09msunsure 🔍
-3% - +3%
-0.99ms - +0.89ms
-unsure 🔍
-3% - +3%
-0.99ms - +0.92ms
preact-hooks28.77ms - 30.15msunsure 🔍
-3% - +3%
-0.98ms - +0.94ms
unsure 🔍
-3% - +3%
-0.92ms - +0.99ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main1.33ms - 1.36ms-unsure 🔍
-2% - +1%
-0.02ms - +0.02ms
faster ✔
0% - 3%
0.00ms - 0.04ms
preact-local1.33ms - 1.36msunsure 🔍
-1% - +2%
-0.02ms - +0.02ms
-unsure 🔍
-3% - +0%
-0.04ms - +0.00ms
preact-hooks1.35ms - 1.38msslower ❌
0% - 3%
0.00ms - 0.04ms
unsure 🔍
-0% - +3%
-0.00ms - +0.04ms
-
hydrate1k

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main122.57ms - 124.43ms-unsure 🔍
-1% - +1%
-0.70ms - +1.38ms
unsure 🔍
-1% - +1%
-1.25ms - +0.93ms
preact-local122.68ms - 123.63msunsure 🔍
-1% - +1%
-1.38ms - +0.70ms
-unsure 🔍
-1% - +0%
-1.24ms - +0.24ms
preact-hooks123.09ms - 124.22msunsure 🔍
-1% - +1%
-0.93ms - +1.25ms
unsure 🔍
-0% - +1%
-0.24ms - +1.24ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main6.11ms - 6.12ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
0% - 1%
0.02ms - 0.03ms
preact-local6.11ms - 6.12msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
0% - 1%
0.01ms - 0.03ms
preact-hooks6.13ms - 6.15msslower ❌
0% - 1%
0.02ms - 0.03ms
slower ❌
0% - 1%
0.01ms - 0.03ms
-
many_updates

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main20.14ms - 20.75ms-unsure 🔍
-7% - +1%
-1.47ms - +0.17ms
unsure 🔍
-4% - +1%
-0.92ms - +0.28ms
preact-local20.34ms - 21.86msunsure 🔍
-1% - +7%
-0.17ms - +1.47ms
-unsure 🔍
-3% - +6%
-0.59ms - +1.25ms
preact-hooks20.25ms - 21.29msunsure 🔍
-1% - +5%
-0.28ms - +0.92ms
unsure 🔍
-6% - +3%
-1.25ms - +0.59ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main4.50ms - 4.53ms-unsure 🔍
-1% - +1%
-0.02ms - +0.02ms
unsure 🔍
-1% - +0%
-0.04ms - +0.01ms
preact-local4.50ms - 4.53msunsure 🔍
-1% - +1%
-0.02ms - +0.02ms
-unsure 🔍
-1% - +0%
-0.04ms - +0.01ms
preact-hooks4.52ms - 4.55msunsure 🔍
-0% - +1%
-0.01ms - +0.04ms
unsure 🔍
-0% - +1%
-0.01ms - +0.04ms
-
text_update

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main3.94ms - 4.27ms-slower ❌
2% - 14%
0.07ms - 0.53ms
unsure 🔍
-7% - +5%
-0.29ms - +0.19ms
preact-local3.64ms - 3.97msfaster ✔
2% - 13%
0.07ms - 0.53ms
-faster ✔
3% - 14%
0.11ms - 0.59ms
preact-hooks3.98ms - 4.32msunsure 🔍
-5% - +7%
-0.19ms - +0.29ms
slower ❌
3% - 16%
0.11ms - 0.59ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main0.64ms - 0.66ms-unsure 🔍
-4% - +1%
-0.03ms - +0.01ms
faster ✔
2% - 7%
0.01ms - 0.05ms
preact-local0.64ms - 0.67msunsure 🔍
-2% - +4%
-0.01ms - +0.03ms
-faster ✔
0% - 6%
0.00ms - 0.04ms
preact-hooks0.67ms - 0.69msslower ❌
2% - 7%
0.01ms - 0.05ms
slower ❌
0% - 6%
0.00ms - 0.04ms
-
todo

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main39.44ms - 39.71ms-unsure 🔍
-1% - +0%
-0.22ms - +0.15ms
faster ✔
3% - 4%
1.18ms - 1.57ms
preact-local39.49ms - 39.73msunsure 🔍
-0% - +1%
-0.15ms - +0.22ms
-faster ✔
3% - 4%
1.15ms - 1.52ms
preact-hooks40.81ms - 41.09msslower ❌
3% - 4%
1.18ms - 1.57ms
slower ❌
3% - 4%
1.15ms - 1.52ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main0.78ms - 0.78ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
3% - 3%
0.02ms - 0.02ms
preact-local0.78ms - 0.78msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
3% - 3%
0.02ms - 0.02ms
preact-hooks0.80ms - 0.80msslower ❌
3% - 3%
0.02ms - 0.02ms
slower ❌
3% - 3%
0.02ms - 0.02ms
-

tachometer-reporter-action v2 for Benchmarks

@coveralls
Copy link

coveralls commented Oct 27, 2023

Coverage Status

coverage: 99.288%. remained the same when pulling 89770f5 on improve-internal-types into cff2df5 on main.

@github-actions
Copy link

github-actions bot commented Oct 27, 2023

Size Change: 0 B

Total Size: 57.2 kB

ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.95 kB 0 B
compat/dist/compat.module.js 3.87 kB 0 B
compat/dist/compat.umd.js 4.01 kB 0 B
debug/dist/debug.js 3.5 kB 0 B
debug/dist/debug.module.js 3.5 kB 0 B
debug/dist/debug.umd.js 3.58 kB 0 B
devtools/dist/devtools.js 231 B 0 B
devtools/dist/devtools.module.js 240 B 0 B
devtools/dist/devtools.umd.js 315 B 0 B
dist/preact.js 4.42 kB 0 B
dist/preact.min.js 4.45 kB 0 B
dist/preact.min.module.js 4.45 kB 0 B
dist/preact.min.umd.js 4.47 kB 0 B
dist/preact.module.js 4.45 kB 0 B
dist/preact.umd.js 4.48 kB 0 B
hooks/dist/hooks.js 1.53 kB 0 B
hooks/dist/hooks.module.js 1.56 kB 0 B
hooks/dist/hooks.umd.js 1.62 kB 0 B
jsx-runtime/dist/jsxRuntime.js 365 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 331 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 445 B 0 B
test-utils/dist/testUtils.js 453 B 0 B
test-utils/dist/testUtils.module.js 454 B 0 B
test-utils/dist/testUtils.umd.js 536 B 0 B

compressed-size-action

package.json Show resolved Hide resolved
Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh this is lovely! Was always annoying me a little that we had to type import("./internal") all the time but didn't know a better solution. Glad to see this being improved 👍

@andrewiggins
Copy link
Member Author

Note, you may have to do import in sub packages. I haven't looked into those yet. If anyone else wants to look at those feel free to.

@andrewiggins andrewiggins merged commit 180b3b1 into main Oct 27, 2023
13 checks passed
@andrewiggins andrewiggins deleted the improve-internal-types branch October 27, 2023 18:37
@JoviDeCroock JoviDeCroock mentioned this pull request Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants