@tsonic/globals 0.1.0 → 0.3.0
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/index.d.ts +9 -5
- package/package.json +5 -2
package/index.d.ts
CHANGED
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
* This package provides:
|
|
7
7
|
* 1. Base types required by TypeScript (Array, String, Object, Function, etc.)
|
|
8
8
|
* 2. Shared types used by both modes (utility types, iterators, Promise, Symbol)
|
|
9
|
+
* 3. BCL primitive methods on String, Number, Boolean (from @tsonic/dotnet)
|
|
9
10
|
*
|
|
10
|
-
* For dotnet mode: Use this package alone.
|
|
11
|
+
* For dotnet mode: Use this package alone. Primitives have BCL methods.
|
|
11
12
|
* For JS mode: Use with @tsonic/js-globals which extends base types with JS methods.
|
|
12
13
|
*/
|
|
13
14
|
|
|
15
|
+
import { String$instance } from "@tsonic/dotnet/System";
|
|
16
|
+
|
|
14
17
|
declare global {
|
|
15
18
|
/**
|
|
16
19
|
* Array type - minimal base definition
|
|
@@ -28,11 +31,11 @@ declare global {
|
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
|
-
* String -
|
|
32
|
-
*
|
|
33
|
-
* In JS mode, @tsonic/js-globals
|
|
34
|
+
* String - augmented with BCL methods from System.String
|
|
35
|
+
* All System.String instance methods are available on string primitives.
|
|
36
|
+
* In JS mode, @tsonic/js-globals may override with JS-specific methods.
|
|
34
37
|
*/
|
|
35
|
-
interface String {}
|
|
38
|
+
interface String extends String$instance {}
|
|
36
39
|
|
|
37
40
|
interface Number {}
|
|
38
41
|
|
|
@@ -100,6 +103,7 @@ declare global {
|
|
|
100
103
|
type ConstructorParameters<T extends new (...args: any) => any> = T extends new (...args: infer P) => any ? P : never;
|
|
101
104
|
type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;
|
|
102
105
|
type InstanceType<T extends new (...args: any) => any> = T extends new (...args: any) => infer R ? R : any;
|
|
106
|
+
type Awaited<T> = T extends PromiseLike<infer U> ? Awaited<U> : T;
|
|
103
107
|
|
|
104
108
|
/**
|
|
105
109
|
* Promise types
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsonic/globals",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Global type definitions for Tsonic with BCL primitive methods",
|
|
5
5
|
"main": "index.d.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"typecheck": "tsc --noEmit"
|
|
13
13
|
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@tsonic/dotnet": "^0.7.6"
|
|
16
|
+
},
|
|
14
17
|
"devDependencies": {
|
|
15
18
|
"typescript": "^5.0.0"
|
|
16
19
|
},
|