-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d326793
commit fedaaf2
Showing
7 changed files
with
231 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,32 @@ | ||
declare module 'num-format' { | ||
function FormatNumber(number: number, precision?: number, locale?: string): string | ||
function FormatPercent(number: number, precision?: number, locale?: string): string | ||
} | ||
/******************************************************************************* | ||
* (c) 2023 unipackage | ||
* | ||
* Licensed under either the MIT License (the "MIT License") or the Apache License, Version 2.0 | ||
* (the "Apache License"). You may not use this file except in compliance with one of these | ||
* licenses. You may obtain a copy of the MIT License at | ||
* | ||
* https://opensource.org/licenses/MIT | ||
* | ||
* Or the Apache License, Version 2.0 at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the MIT License or the Apache License for the specific language governing permissions and | ||
* limitations under the respective licenses. | ||
********************************************************************************/ | ||
|
||
declare module "num-format" { | ||
function FormatNumber( | ||
number: number, | ||
precision?: number, | ||
locale?: string | ||
): string | ||
function FormatPercent( | ||
number: number, | ||
precision?: number, | ||
locale?: string | ||
): string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,40 @@ | ||
/******************************************************************************* | ||
* (c) 2023 unipackage | ||
* | ||
* Licensed under either the MIT License (the "MIT License") or the Apache License, Version 2.0 | ||
* (the "Apache License"). You may not use this file except in compliance with one of these | ||
* licenses. You may obtain a copy of the MIT License at | ||
* | ||
* https://opensource.org/licenses/MIT | ||
* | ||
* Or the Apache License, Version 2.0 at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the MIT License or the Apache License for the specific language governing permissions and | ||
* limitations under the respective licenses. | ||
********************************************************************************/ | ||
|
||
/** | ||
* Represents the result of an operation that can be either successful or have an error. | ||
* @template T The type of data associated with the result. | ||
*/ | ||
export interface Result<T> { | ||
ok: boolean; | ||
data?: T; | ||
error?: any; | ||
} | ||
/** | ||
* Indicates whether the operation was successful (`true`) or had an error (`false`). | ||
*/ | ||
ok: boolean | ||
|
||
/** | ||
* The data associated with the result. It is present when the operation is successful. | ||
*/ | ||
data?: T | ||
|
||
/** | ||
* The error information. It is present when the operation has an error. | ||
*/ | ||
error?: any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,33 @@ | ||
/******************************************************************************* | ||
* (c) 2023 unipackage | ||
* | ||
* Licensed under either the MIT License (the "MIT License") or the Apache License, Version 2.0 | ||
* (the "Apache License"). You may not use this file except in compliance with one of these | ||
* licenses. You may obtain a copy of the MIT License at | ||
* | ||
* https://opensource.org/licenses/MIT | ||
* | ||
* Or the Apache License, Version 2.0 at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the MIT License or the Apache License for the specific language governing permissions and | ||
* limitations under the respective licenses. | ||
********************************************************************************/ | ||
|
||
/** | ||
* Represents a type that includes all non-function fields from another type. | ||
* @template T The type from which to extract non-function fields. | ||
*/ | ||
export type ValueFields<T> = Pick< | ||
T, | ||
{ | ||
/** | ||
* Extracts non-function fields from the provided type. | ||
*/ | ||
[K in keyof T]: T[K] extends Function ? never : K | ||
}[keyof T] | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters