@tdi2/di-core
Version:
TypeScript Dependency Injection 2 - Core DI framework
34 lines (33 loc) • 1.12 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
// tools/functional-di-enhanced-transformer/__tests__/__fixtures__/inline-all-required.basic.transformed.snap.tsx
import React from "react";
function InlineAllRequired(props) {
const api = props.services?.api;
if (!api) {
throw new Error("Could not find implementation for 'ApiInterface'");
}
const logger = props.services?.logger;
const { id } = props;
if (!logger) {
throw new Error("Could not find implementation for 'LoggerInterface'");
}
const user = props.services?.user;
if (!user) {
throw new Error("Could not find implementation for 'UserServiceInterface'");
}
React.useEffect(() => {
logger.log(`Loading data for ${id}`);
api.getData().then((data) => {
user.processData(data);
});
}, [
id
]);
return /* @__PURE__ */ React.createElement("div", null, "ID: ", id);
}
__name(InlineAllRequired, "InlineAllRequired");
export {
InlineAllRequired
};
//# sourceMappingURL=inline-all-required.basic.transformed.snap.js.map