@tdi2/di-core
Version:
TypeScript Dependency Injection 2 - Core DI framework
36 lines (35 loc) • 1.33 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
// tools/functional-di-enhanced-transformer/__tests__/__fixtures__/deep-destructuring.basic.transformed.snap.tsx
import React from "react";
function DeepDestructuring(props) {
const api = props.services?.api;
if (!api) {
throw new Error("Could not find implementation for 'ApiInterface'");
}
const { user: { profile: { settings: { theme, notifications } } }, config: { apiUrl, timeout } } = props;
const logger = props.services?.logger;
if (!logger) {
throw new Error("Could not find implementation for 'LoggerInterface'");
}
React.useEffect(() => {
logger.log(`Theme: ${theme}, Notifications: ${notifications}`);
api.configure({
url: apiUrl,
timeout
});
}, [
theme,
notifications,
apiUrl,
timeout
]);
return /* @__PURE__ */ React.createElement("div", {
"data-theme": theme
}, /* @__PURE__ */ React.createElement("p", null, "API: ", apiUrl, " (timeout: ", timeout, "ms)"), /* @__PURE__ */ React.createElement("p", null, "Notifications: ", notifications ? "on" : "off"));
}
__name(DeepDestructuring, "DeepDestructuring");
export {
DeepDestructuring
};
//# sourceMappingURL=deep-destructuring.basic.transformed.snap.js.map