1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

BigInt, rollover, and developer lint

This commit is contained in:
Travis Ralston
2021-06-11 11:18:18 -06:00
parent f1e270ca9d
commit 5715df6b18
6 changed files with 104 additions and 42 deletions

View File

@@ -19,16 +19,14 @@ limitations under the License.
* is provided that the stable prefix should be used when representing the identifier.
*/
export class NamespacedValue<S extends string, U extends string> {
public constructor(public readonly stable: S, public readonly unstable?: U) {
// Stable is optional, but one of the two parameters is required, hence the weird-looking types.
// Goal is to to have developers explicitly say there is no stable value (if applicable).
public constructor(public readonly stable: S | null | undefined, public readonly unstable?: U) {
if (!this.unstable && !this.stable) {
throw new Error("One of stable or unstable values must be supplied");
}
}
public get tsType(): U | S {
return null; // irrelevant return
}
public get name(): U | S {
if (this.stable) {
return this.stable;