feat: Utils to do bindLan and have ipv4 and ipv6 if need be

This commit is contained in:
BluJ
2023-04-27 11:22:42 -06:00
parent 353692bf55
commit c7d38fc7ce
79 changed files with 1754 additions and 1744 deletions

View File

@@ -1,81 +1,79 @@
import { T } from "..";
import { utils } from "../util";
import { T } from ".."
import { utils } from "../util"
type WrapperType = {
config: {
someValue: string;
};
};
someValue: string
}
}
const todo = <A>(): A => {
throw new Error("not implemented");
};
const noop = () => {};
throw new Error("not implemented")
}
const noop = () => {}
describe("wrapperData", () => {
test.skip("types", async () => {
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData(
"/config/someValue",
"someValue",
);
)
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData(
"/config/someValue",
// @ts-expect-error Type is wrong for the setting value
5,
);
)
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData(
// @ts-expect-error Path is wrong
"/config/someVae3lue",
"someValue",
);
)
todo<T.Effects>().setWrapperData<WrapperType, "/config/someValue">({
path: "/config/someValue",
value: "someValueIn",
});
})
todo<T.Effects>().setWrapperData<WrapperType, "/config/some2Value">({
//@ts-expect-error Path is wrong
path: "/config/someValue",
//@ts-expect-error Path is wrong
value: "someValueIn",
});
})
todo<T.Effects>().setWrapperData<WrapperType, "/config/someValue">({
//@ts-expect-error Path is wrong
path: "/config/some2Value",
value: "someValueIn",
});
(await utils<WrapperType>(todo<T.Effects>())
})
;(await utils<WrapperType>(todo<T.Effects>())
.getOwnWrapperData("/config/someValue")
.const()) satisfies string;
(await utils<WrapperType>(todo<T.Effects>())
.const()) satisfies string
;(await utils<WrapperType>(todo<T.Effects>())
.getOwnWrapperData("/config")
.const()) satisfies WrapperType["config"];
.const()) satisfies WrapperType["config"]
await utils<WrapperType>(todo<T.Effects>())
// @ts-expect-error Path is wrong
.getOwnWrapperData("/config/somdsfeValue")
.const();
(await utils<WrapperType>(todo<T.Effects>())
.const()
;(await utils<WrapperType>(todo<T.Effects>())
.getOwnWrapperData("/config/someValue")
// @ts-expect-error satisfies type is wrong
.const()) satisfies number;
(await utils<WrapperType>(todo<T.Effects>())
.const()) satisfies number
;(await utils<WrapperType>(todo<T.Effects>())
// @ts-expect-error Path is wrong
.getOwnWrapperData("/config/")
.const()) satisfies WrapperType["config"];
(await todo<T.Effects>().getWrapperData<WrapperType, "/config/someValue">({
.const()) satisfies WrapperType["config"]
;(await todo<T.Effects>().getWrapperData<WrapperType, "/config/someValue">({
path: "/config/someValue",
callback: noop,
})) satisfies string;
})) satisfies string
await todo<T.Effects>().getWrapperData<WrapperType, "/config/someValue">({
// @ts-expect-error Path is wrong as in it doesn't match above
path: "/config/someV2alue",
callback: noop,
});
})
await todo<T.Effects>().getWrapperData<WrapperType, "/config/someV2alue">({
// @ts-expect-error Path is wrong as in it doesn't exists in wrapper type
path: "/config/someV2alue",
callback: noop,
});
});
});
})
})
})