cost 246 ms
plainToClass 在 web 工作线程中调用 object.method() - plainToClass to call object.method() in web worker thread

我正在使用角度,试图将一个对象传递给后台进程的网络工作者。 班级是 因为在web worker线程中,我要使用article.method1(), 对象传递给web worker后,就变成了一个没有方法只有属性的对象。 为什么是这样? 作为字符串传递? 尝试使用plainToClas ...

typescript 属性装饰器可以修改实例成员而不是整个 class 吗? - Can typescript property decorators modify instance members instead of the entire class?

我想写一个消毒剂装饰器,我可以把它放在所有用户输入的字符串字段上。 这只是将标准的.set(newValue)替换为.set( sanitize(newValue) ) 。 但是我发现下面的代码只适用于一个实例。 相同 class 的第二个实例最终共享 currentValue。 进一步阅读后,这 ...

当 typeorm/browser/index.js 抛出“模块解析失败:'import' 和 'export' 可能只出现 'sourceType: module' 错误”时会发生什么? - What happens when `typeorm/browser/index.js` throws "Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' error"?

我最近想出了一个新的纯 JS web 应用程序运行在 Node.js(不导入关于 TypeScript 的任何东西),以 Next.js@12.0.10 作为框架和 TypeORM@0.2.41 作为 ORM 层到 Azure 88129926.152588 服务器一切正常,我已经成功连接到 SQ ...

tsyringe container.resolve 在自定义装饰器中创建一个新的调用实例 - tsyringe container.resolve creates a new instance on call in custom decorator

我正在尝试为tsyringe创建一个自定义装饰器以通过属性注入。 我的代码: 服务 调用 Class 控制台 Output 当前行为:每次我调用注入的 class 的方法时,都会再次调用我的构造函数。 这意味着我的 class 在每次新调用时都会进行新的初始化。 当我使用以下代码时,一切似乎都在工作 ...

typeORM: "message": "\\"postgres\\" 数据库不支持 \\"..." 中的数据类型 \\"Object\\"。" - typeORM: "message": "Data type \"Object\" in \"..." is not supported by \"postgres\" database."

鉴于以下实体定义: @Entity() export class User extends BaseEntity { @Column({ nullable: true }) name!: string | null; @Column() age!: number; } 出现 ...

反射元数据:检查属性是否具有“Output()”装饰器 - Reflect-metadata: check if property has "Output()" decorator

我正在编写一个 Angular 库。 一个对象包装了一个 Angular 组件实例,并且这个对象必须订阅组件实例中所有用Output装饰器标记的主题。 这是我迄今为止在构造函数中编写的代码: Reflect.getMetadata返回 false 还分析了 angular 组件内的属性“tes ...

Typescript 装饰器:从方法装饰器中获取类装饰器值 - Typescript decorator: get class decorator value from method decorator

我有一个类装饰器(fooAnnotation)和方法装饰器(barDecorator)。 我的需要是 barAnnotation 必须使用 fooAnnotation 的值,但不幸的是 typescript 在方法装饰器之后评估类装饰器,所以在 barAnnotation 中还没有定义 fooA ...

无法在Production Server中的Docker容器上对'reflect-metadata'进行模块化 - Can't module 'reflect-metadata' on Docker container in Production Server

我得到一个错误 在生产服务器上运行docker-compose时。 尽管我已经在本地计算机上成功运行了它,但确实很难理解为什么在生产服务器中发生了此错误? 我的package.json: { ... "dependencies": { "@types/mocha": "2.2. ...

加载器异常/装饰器的循环引用 - loader exception / circular reference by decorators

题 我得到一个循环加载器异常。 这可能是由编译器选项"emitDecoratorMetadata":true 。 我该如何解决? 感谢有用的重播! 介绍 我准备了一个最小的项目来重现错误。 请查看我的临时 git 存储库:用于错误演示的 git repo 我使用两个库( typeorm和json ...

打字稿无法从打字稿装饰器访问属性类型。 (目标是:{}) - Typescript cannot access property type from typescript decorator. (Target is: {})

我目前正在实现一个在 VUE js 项目中使用的依赖注入器。 我创建了一个 Inject 装饰器,我希望能够访问一个属性类型,我昨天让它工作了,但发生了一些事情,我完全迷失了。 我已经控制台注销 JSON.stringify(target) 并且我收到一个空对象,这意味着我的装饰器在构建类之前正在 ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM