@spidunno/desmos-types 1.13.5 → 1.13.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/module/index.d.ts +5 -2
- package/module/internals.d.ts +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@ the graphing calculator, geometry tool, 3D calculator, and the four-function and
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npm install --save-dev @spidunno/desmos-types@~1.13.
|
|
9
|
+
npm install --save-dev @spidunno/desmos-types@~1.13.6
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
The package's major and minor version match the Desmos API version it describes; patch releases
|
|
13
|
-
are fixes to the types. Use a tilde range (`~1.13.
|
|
13
|
+
are fixes to the types. Use a tilde range (`~1.13.6`), not npm's default caret (`^`), so you only
|
|
14
14
|
get type fixes for the API version you load.
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
@@ -62,7 +62,7 @@ script. If you load the API some other way, for example into a scope of your own
|
|
|
62
62
|
types, but nothing global:
|
|
63
63
|
|
|
64
64
|
```ts
|
|
65
|
-
import type
|
|
65
|
+
import type { Desmos } from '@spidunno/desmos-types/module'; // or '/module/internals'
|
|
66
66
|
|
|
67
67
|
async function loadDesmos(): Promise<typeof Desmos> {
|
|
68
68
|
/* ... */
|
|
@@ -72,8 +72,10 @@ const api = await loadDesmos();
|
|
|
72
72
|
const calculator: Desmos.GraphingCalculator = api.GraphingCalculator(element);
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
`Desmos` is a type-only export, since the package contains no JavaScript: using it as a value is a
|
|
76
|
+
compile error, and editors auto-import it with `import type` (or with a plain import that
|
|
77
|
+
TypeScript removes, unless `verbatimModuleSyntax` is on). Don't also include the default entry
|
|
78
|
+
points (in `compilerOptions.types` or a `/// <reference>`), or the global comes back.
|
|
77
79
|
|
|
78
80
|
## Layout
|
|
79
81
|
|
package/module/index.d.ts
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
// Unlike the default entry points, this declares no globals: `Desmos` exists
|
|
5
5
|
// only where you import it. Use it when the API object is not `window.Desmos`,
|
|
6
|
-
// for example when you load calculator.js into a scope of your own
|
|
6
|
+
// for example when you load calculator.js into a scope of your own:
|
|
7
|
+
//
|
|
8
|
+
// import type { Desmos } from '@spidunno/desmos-types/module';
|
|
9
|
+
// declare const api: typeof Desmos;
|
|
7
10
|
|
|
8
11
|
/// <reference lib="dom" />
|
|
9
12
|
|
|
@@ -1944,4 +1947,4 @@ declare namespace Desmos {
|
|
|
1944
1947
|
const commit: string;
|
|
1945
1948
|
}
|
|
1946
1949
|
|
|
1947
|
-
export
|
|
1950
|
+
export type { Desmos };
|
package/module/internals.d.ts
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
// Unlike the default entry points, this declares no globals: `Desmos` exists
|
|
5
5
|
// only where you import it. Use it when the API object is not `window.Desmos`,
|
|
6
|
-
// for example when you load calculator.js into a scope of your own
|
|
6
|
+
// for example when you load calculator.js into a scope of your own:
|
|
7
|
+
//
|
|
8
|
+
// import type { Desmos } from '@spidunno/desmos-types/module';
|
|
9
|
+
// declare const api: typeof Desmos;
|
|
7
10
|
|
|
8
11
|
/// <reference lib="dom" />
|
|
9
12
|
|
|
@@ -8178,4 +8181,4 @@ declare namespace Desmos {
|
|
|
8178
8181
|
}
|
|
8179
8182
|
}
|
|
8180
8183
|
|
|
8181
|
-
export
|
|
8184
|
+
export type { Desmos };
|