This PR finishes adding types (partial types were added in #1592, #1593 did some prerequisite rearrangement).

To generate the types correctly in `pyproxy.js`, I changed the protocols like `PyProxyLengthMethods` into ES6 classes (they used to just be objects). This was needed because otherwise Typescript makes the protocol into a namespace but I want it to be a type to indicate that an object has certain methods. To compensate for this change, I had to modify `getPyProxyClass` accordingly. This change required a number of syntactical changes.

I also added a bunch of predicate methods to the base `PyProxy` class to test whether the proxy supports certain extra methods. These are needed to use as Typescript type guards, but they probably are also useful by themselves when code needs to do reflection on the proxies.

I don't know whether the exposed types or the type guard predicates are well named, I would be happy for recommendations of improvements to the names -- both the type names and the predicates are public and deserve to be named with care.

JsDoc does not recognize typescript type guards or typescript type definitions, so I added a JsDoc plugin which strips out type definitions and transforms typeguards `x is y` ==> `boolean`. There's one JsDoc typescript parse error that still happens but it doesn't cause any harm to the output.

I also changed the way that we collect javascript API docs to be a bit more robust. In particular, it used to be organized by file. I changed it as follows: 
1. any API part of `globalThis` or marked with `@memberof globalThis` is treated as a global, 
2. any API of a class whose name starts with `PyProxy` is treated as a part of the `PyProxy` API,
3. anything else is assumed to be part of the pyodide API

As before, things marked `@private` are left out.

I also added tests for the type declarations using `tpd`. They are a new CI step.


ENH More complete typescript types. This PR finishes adding types (partial types were added in #1592, #1593 did some prerequisite rearrangement).

To generate the types correctly in `pyproxy.js`, I changed the protocols like `PyProxyLengthMethods` into ES6 classes (they used to just be objects). This was needed because otherwise Typescript makes the protocol into a namespace but I want it to be a type to indicate that an object has certain methods. To compensate for this change, I had to modify `getPyProxyClass` accordingly. This change required a number of syntactical changes.

I also added a bunch of predicate methods to the base `PyProxy` class to test whether the proxy supports certain extra methods. These are needed to use as Typescript type guards, but they probably are also useful by themselves when code needs to do reflection on the proxies.

I don't know whether the exposed types or the type guard predicates are well named, I would be happy for recommendations of improvements to the names -- both the type names and the predicates are public and deserve to be named with care.

JsDoc does not recognize typescript type guards or typescript type definitions, so I added a JsDoc plugin which strips out type definitions and transforms typeguards `x is y` ==> `boolean`. There's one JsDoc typescript parse error that still happens but it doesn't cause any harm to the output.

I also changed the way that we collect javascript API docs to be a bit more robust. In particular, it used to be organized by file. I changed it as follows: 
1. any API part of `globalThis` or marked with `@memberof globalThis` is treated as a global, 
2. any API of a class whose name starts with `PyProxy` is treated as a part of the `PyProxy` API,
3. anything else is assumed to be part of the pyodide API

As before, things marked `@private` are left out.

I also added tests for the type declarations using `tpd`. They are a new CI step.


# pack-refs with: peeled fully-peeled sorted 
5ef3d784aa31f0968a18d76dbf0a4927ce3b86e2 refs/remotes/origin/0.17.X
d5dc6559ca3a42efbafb933fe3b43824d3ed2f23 refs/remotes/origin/0.18.X
c73008ef97d7826299d401644f5f84a9487bfe33 refs/remotes/origin/0.19.X
7a9273dd6c893ab1273f8c5d22f62f60296f13d5 refs/remotes/origin/0.20.X
fcf7b9c5e8b766b373fd55309b16f68517a79f51 refs/remotes/origin/0.21.X
5ef5622414f0fe8ab8c54694e04ab1b13939b7d4 refs/remotes/origin/0.22.X
08d6b094942160326b4e31fac965e90284207373 refs/remotes/origin/0.23.X
0c9f495eb33b45f83db38c46495ad73988d3aefd refs/remotes/origin/bump-pyodide-env-docker-image
f1498a2747d5dc968dad2d872181d9cad2d80a48 refs/remotes/origin/main
f95474518535f4aa4d9dafef1540f01372f3aa2f refs/remotes/origin/pre-commit-ci-update-config
47c393cfb8e93ab73f98c43e08945c31597283e9 refs/remotes/origin/python3.11.3
f7b61b744aee7b6660bc4f779f66993c95551480 refs/remotes/origin/python3.11.4-docker
8dad689ff06c3102ce1f42c2ff42c990532d37aa refs/remotes/origin/revert-3487-some-backports-for-0.22.1
516273e5c1848f56a07c755cd22c62c1846ce234 refs/remotes/origin/stable
02ce5a4a9e31e865b7c9706ee6db93558c7cb0d9 refs/tags/0.1.0
ff5b9e61daf11eb9b656f727efa46e14fb0b5fe1 refs/tags/0.1.10
294aee577c09b8889ed2ebeac59703443c0eab22 refs/tags/0.1.11
f88b259894fcd2e1332377ed1b99fcbde54faadd refs/tags/0.1.12
30e7cc1182097d417b2b219dcd70b96ffa9ec9ee refs/tags/0.1.8
b4830f8f663e71d65bb9ae8ba5af0cb9cdbd702e refs/tags/0.1.9
cda2682ac7842bc1ba5380763bf1082801d9fe23 refs/tags/0.10.0
a39544a0718a309f15bc87d744b9739e1c0aa34e refs/tags/0.11.0
32aacec222f69585f4e6531a20f7eae0408f4cea refs/tags/0.12.0
2fb13ff35b000f48b6d6b8ee7969694391959ca0 refs/tags/0.13.0
b702a1bd9a5dca2917f0130c08fde4f374c30686 refs/tags/0.13.1
1ade2088bca11053194f77efbf08a0c2ff2eb6a5 refs/tags/0.14.0
72a410c5ff8bcac5a41d5c4a10d2dcc574f8df0c refs/tags/0.14.1
e229a69dc550471cf3c643296fce4f8d1ac962c0 refs/tags/0.14.2
ff24a999be26c0b650adc53ab5bfea722447317f refs/tags/0.14.3
94000642d5bcab1797533bf0b99161c0b67e7bf5 refs/tags/0.15.0
47878173c1b16475994b5b7f865defbc2aea87aa refs/tags/0.16.0
0d10cfaded5586ffc21ed38c7b2d392490871c6e refs/tags/0.16.1
c49dd7ad5f83b560dcad9c290716c63b1ac73942 refs/tags/0.17.0
a4fad9b500c9a2dee6353e4d14bbf30f319ca5d3 refs/tags/0.17.0a1
afb522ed59a08dc7edd0ae7935ec2999d55ed544 refs/tags/0.17.0a2
250c48038b7b71f72d8f345fbec57ce3c7c14e7b refs/tags/0.18.0
332fbcbd923e133e9eb199ada4fdd0365020523b refs/tags/0.18.0a1
796e58ce1b83afd7e81d814f888f9ac602f7db53 refs/tags/0.18.1
276d396fffd9bc9fa1453ce48d32ad42c5381756 refs/tags/0.19.0
07e92b806d38b2bae2ee7aa0e30078006ed50b70 refs/tags/0.19.0a1
ab08812ca564738966cd57024f0931c065a461e5 refs/tags/0.19.1
de7dd4be6f6ba33ea2418cf5aaf8653cf319b357 refs/tags/0.2.0
7a9273dd6c893ab1273f8c5d22f62f60296f13d5 refs/tags/0.20.0
22a001410a12963142e71ad7442374364e80c2c1 refs/tags/0.20.0a1
07be1f4e2faca65313e601e84d5ba628e4a967dc refs/tags/0.20.1a1
5e412795ed5a71c3c24f52e0e554a7e3072ec787 refs/tags/0.21.0
c540ce9b9c36663bd06c1a6cb048c6696d0efd6c refs/tags/0.21.0a2
2f1c19700765851ed208d4d0f2251003ca33c998 refs/tags/0.21.0a3
9ef3cac19827f0215aaf1fa6161a773551d40728 refs/tags/0.21.1
e2ce091b4c9953f06deca7a6c4f1b52ea716d53b refs/tags/0.21.2
faa3b8ccb32867a3feb7e7a45ffd5c26fa6a47d2 refs/tags/0.21.3
8e965e57d4cc5d4367e0d761b645d8238b7eb0c3 refs/tags/0.22.0
13526ac8ff3aba54857aa61a5cba04cb1a2e543f refs/tags/0.22.0a1
ef64c06f5b60333cdfc5382858e009e780361136 refs/tags/0.22.0a2
0b4e19dbe15a94d79c2bcbb2cfb6bfb8ba52e7f5 refs/tags/0.22.0a3
5ef5622414f0fe8ab8c54694e04ab1b13939b7d4 refs/tags/0.22.1
53de1c3e722299b20c331ab5efe6c56fa9b3578d refs/tags/0.23.0
2eaee0673ddb94e235983e30c5e15095ec98e707 refs/tags/0.23.0a1
a42cc0c6a473045069e0ca2ea6b5f854078e7365 refs/tags/0.23.1
69bbc529456b181fa5242f8eee007eb877a9a9a1 refs/tags/0.23.2
fa61893f70c59afda0d7df6b5a0c5d05911193fc refs/tags/0.23.3
25b404e92af175383b0736a8663ab95e8516ad3e refs/tags/0.23.4
660388431f11f8eb5be438edc192b81e82917d76 refs/tags/0.24.0
77dbe16a5ec3061b71c8ea2d989c98cf7e4bbd37 refs/tags/0.24.0a1
bda1ba4edf6e4140952c5596e4af47521d21f7eb refs/tags/0.24.1
fd270ddde7df9fde6827bbfab07a992fec11b4a9 refs/tags/0.25.0a1
77afe0d71ccd60f2e78c94618c2cc3ca5db58128 refs/tags/0.25.0a2
82d0c4cbfdcf1b5191f8bd65d31716877ebe281b refs/tags/0.3.0
a134831abacee198c1b1426d2313d03a39057b91 refs/tags/0.4.0
89954025b875a8bdf5d9da00bdb1247bd70e0c33 refs/tags/0.5.0
60977f0db8a2a6bf308851e6227c3d61b22f831d refs/tags/0.6.0
829285339ad6ed7b78f7b2488a30f2aff2eef794 refs/tags/0.6.1
73e10c60bf57a051d56aa47840c25e271d9123ba refs/tags/0.7.0
7a496116e8b5dca681fe0c663f7397881dd18e3d refs/tags/0.7.1
18bcd9e61c7317592b36bde95871798ebf8dfc20 refs/tags/0.7.2
16580a16cac1cab40f1b016f5851a69a95918577 refs/tags/0.8.0
8da4b1f5f19ec4ce6ff9fb601a2e6d684d410ee8 refs/tags/0.8.1
63b6ba23e8844bc660e438e5aaf78b9f6c0d2d45 refs/tags/0.8.2
89eca5f5b788edf0a3f425fd9217d0c028a3eebd refs/tags/0.9.0
7103d810ea5c818243e44a609589d70650c23834 refs/tags/list
a9ebe110f2d20a125df8f4a689c88d2e71fbc433 refs/tags/push
2ca008bb24723269dcba03d3808e8666132dfb55 refs/tags/v0.1.0
76415e4abd6586890656e3a2daff3fceee3a2cdc refs/tags/v0.1.1
b50c8d622fc8b1730f0bb965c4eb2b271e3869a9 refs/tags/v0.1.2
b50c8d622fc8b1730f0bb965c4eb2b271e3869a9 refs/tags/v0.1.3
6814e077dad29ccc80d4810fb2c1288c59240699 refs/tags/v0.1.4
5cabeb8c97fbd071389470fd77623fe3a78ba9d7 refs/tags/v0.1.5
f6ad68fdf2d3c47b56a40c176380ec02e776f773 refs/tags/v0.1.6
276aff3ecadb34681a065fe8cadb178b58f5aa4a refs/tags/v0.1.7

# pack-refs with: peeled fully-peeled sorted 
5ef3d784aa31f0968a18d76dbf0a4927ce3b86e2 refs/remotes/origin/0.17.X
d5dc6559ca3a42efbafb933fe3b43824d3ed2f23 refs/remotes/origin/0.18.X
c73008ef97d7826299d401644f5f84a9487bfe33 refs/remotes/origin/0.19.X
7a9273dd6c893ab1273f8c5d22f62f60296f13d5 refs/remotes/origin/0.20.X
fcf7b9c5e8b766b373fd55309b16f68517a79f51 refs/remotes/origin/0.21.X
5ef5622414f0fe8ab8c54694e04ab1b13939b7d4 refs/remotes/origin/0.22.X
08d6b094942160326b4e31fac965e90284207373 refs/remotes/origin/0.23.X
0c9f495eb33b45f83db38c46495ad73988d3aefd refs/remotes/origin/bump-pyodide-env-docker-image
f1498a2747d5dc968dad2d872181d9cad2d80a48 refs/remotes/origin/main
f95474518535f4aa4d9dafef1540f01372f3aa2f refs/remotes/origin/pre-commit-ci-update-config
47c393cfb8e93ab73f98c43e08945c31597283e9 refs/remotes/origin/python3.11.3
f7b61b744aee7b6660bc4f779f66993c95551480 refs/remotes/origin/python3.11.4-docker
8dad689ff06c3102ce1f42c2ff42c990532d37aa refs/remotes/origin/revert-3487-some-backports-for-0.22.1
516273e5c1848f56a07c755cd22c62c1846ce234 refs/remotes/origin/stable
02ce5a4a9e31e865b7c9706ee6db93558c7cb0d9 refs/tags/0.1.0
ff5b9e61daf11eb9b656f727efa46e14fb0b5fe1 refs/tags/0.1.10
294aee577c09b8889ed2ebeac59703443c0eab22 refs/tags/0.1.11
f88b259894fcd2e1332377ed1b99fcbde54faadd refs/tags/0.1.12
30e7cc1182097d417b2b219dcd70b96ffa9ec9ee refs/tags/0.1.8
b4830f8f663e71d65bb9ae8ba5af0cb9cdbd702e refs/tags/0.1.9
cda2682ac7842bc1ba5380763bf1082801d9fe23 refs/tags/0.10.0
a39544a0718a309f15bc87d744b9739e1c0aa34e refs/tags/0.11.0
32aacec222f69585f4e6531a20f7eae0408f4cea refs/tags/0.12.0
2fb13ff35b000f48b6d6b8ee7969694391959ca0 refs/tags/0.13.0
b702a1bd9a5dca2917f0130c08fde4f374c30686 refs/tags/0.13.1
1ade2088bca11053194f77efbf08a0c2ff2eb6a5 refs/tags/0.14.0
72a410c5ff8bcac5a41d5c4a10d2dcc574f8df0c refs/tags/0.14.1
e229a69dc550471cf3c643296fce4f8d1ac962c0 refs/tags/0.14.2
ff24a999be26c0b650adc53ab5bfea722447317f refs/tags/0.14.3
94000642d5bcab1797533bf0b99161c0b67e7bf5 refs/tags/0.15.0
47878173c1b16475994b5b7f865defbc2aea87aa refs/tags/0.16.0
0d10cfaded5586ffc21ed38c7b2d392490871c6e refs/tags/0.16.1
c49dd7ad5f83b560dcad9c290716c63b1ac73942 refs/tags/0.17.0
a4fad9b500c9a2dee6353e4d14bbf30f319ca5d3 refs/tags/0.17.0a1
afb522ed59a08dc7edd0ae7935ec2999d55ed544 refs/tags/0.17.0a2
250c48038b7b71f72d8f345fbec57ce3c7c14e7b refs/tags/0.18.0
332fbcbd923e133e9eb199ada4fdd0365020523b refs/tags/0.18.0a1
796e58ce1b83afd7e81d814f888f9ac602f7db53 refs/tags/0.18.1
276d396fffd9bc9fa1453ce48d32ad42c5381756 refs/tags/0.19.0
07e92b806d38b2bae2ee7aa0e30078006ed50b70 refs/tags/0.19.0a1
ab08812ca564738966cd57024f0931c065a461e5 refs/tags/0.19.1
de7dd4be6f6ba33ea2418cf5aaf8653cf319b357 refs/tags/0.2.0
7a9273dd6c893ab1273f8c5d22f62f60296f13d5 refs/tags/0.20.0
22a001410a12963142e71ad7442374364e80c2c1 refs/tags/0.20.0a1
07be1f4e2faca65313e601e84d5ba628e4a967dc refs/tags/0.20.1a1
5e412795ed5a71c3c24f52e0e554a7e3072ec787 refs/tags/0.21.0
c540ce9b9c36663bd06c1a6cb048c6696d0efd6c refs/tags/0.21.0a2
2f1c19700765851ed208d4d0f2251003ca33c998 refs/tags/0.21.0a3
9ef3cac19827f0215aaf1fa6161a773551d40728 refs/tags/0.21.1
e2ce091b4c9953f06deca7a6c4f1b52ea716d53b refs/tags/0.21.2
faa3b8ccb32867a3feb7e7a45ffd5c26fa6a47d2 refs/tags/0.21.3
8e965e57d4cc5d4367e0d761b645d8238b7eb0c3 refs/tags/0.22.0
13526ac8ff3aba54857aa61a5cba04cb1a2e543f refs/tags/0.22.0a1
ef64c06f5b60333cdfc5382858e009e780361136 refs/tags/0.22.0a2
0b4e19dbe15a94d79c2bcbb2cfb6bfb8ba52e7f5 refs/tags/0.22.0a3
5ef5622414f0fe8ab8c54694e04ab1b13939b7d4 refs/tags/0.22.1
53de1c3e722299b20c331ab5efe6c56fa9b3578d refs/tags/0.23.0
2eaee0673ddb94e235983e30c5e15095ec98e707 refs/tags/0.23.0a1
a42cc0c6a473045069e0ca2ea6b5f854078e7365 refs/tags/0.23.1
69bbc529456b181fa5242f8eee007eb877a9a9a1 refs/tags/0.23.2
fa61893f70c59afda0d7df6b5a0c5d05911193fc refs/tags/0.23.3
25b404e92af175383b0736a8663ab95e8516ad3e refs/tags/0.23.4
660388431f11f8eb5be438edc192b81e82917d76 refs/tags/0.24.0
77dbe16a5ec3061b71c8ea2d989c98cf7e4bbd37 refs/tags/0.24.0a1
bda1ba4edf6e4140952c5596e4af47521d21f7eb refs/tags/0.24.1
fd270ddde7df9fde6827bbfab07a992fec11b4a9 refs/tags/0.25.0a1
77afe0d71ccd60f2e78c94618c2cc3ca5db58128 refs/tags/0.25.0a2
82d0c4cbfdcf1b5191f8bd65d31716877ebe281b refs/tags/0.3.0
a134831abacee198c1b1426d2313d03a39057b91 refs/tags/0.4.0
89954025b875a8bdf5d9da00bdb1247bd70e0c33 refs/tags/0.5.0
60977f0db8a2a6bf308851e6227c3d61b22f831d refs/tags/0.6.0
829285339ad6ed7b78f7b2488a30f2aff2eef794 refs/tags/0.6.1
73e10c60bf57a051d56aa47840c25e271d9123ba refs/tags/0.7.0
7a496116e8b5dca681fe0c663f7397881dd18e3d refs/tags/0.7.1
18bcd9e61c7317592b36bde95871798ebf8dfc20 refs/tags/0.7.2
16580a16cac1cab40f1b016f5851a69a95918577 refs/tags/0.8.0
8da4b1f5f19ec4ce6ff9fb601a2e6d684d410ee8 refs/tags/0.8.1
63b6ba23e8844bc660e438e5aaf78b9f6c0d2d45 refs/tags/0.8.2
89eca5f5b788edf0a3f425fd9217d0c028a3eebd refs/tags/0.9.0
7103d810ea5c818243e44a609589d70650c23834 refs/tags/list
a9ebe110f2d20a125df8f4a689c88d2e71fbc433 refs/tags/push
2ca008bb24723269dcba03d3808e8666132dfb55 refs/tags/v0.1.0
76415e4abd6586890656e3a2daff3fceee3a2cdc refs/tags/v0.1.1
b50c8d622fc8b1730f0bb965c4eb2b271e3869a9 refs/tags/v0.1.2
b50c8d622fc8b1730f0bb965c4eb2b271e3869a9 refs/tags/v0.1.3
6814e077dad29ccc80d4810fb2c1288c59240699 refs/tags/v0.1.4
5cabeb8c97fbd071389470fd77623fe3a78ba9d7 refs/tags/v0.1.5
f6ad68fdf2d3c47b56a40c176380ec02e776f773 refs/tags/v0.1.6
276aff3ecadb34681a065fe8cadb178b58f5aa4a refs/tags/v0.1.7
