小编har*_*bar的帖子

找不到模块“graphql/tsutils/Maybe”或其相应的类型声明

这个问题从未存在过,没有任何条件改变node_modules/@apollo/federation/dist/composition/utils.d.ts:3:19 - 错误TS2307:找不到模块'graphql/tsutils/Maybe'或其相应的类型声明。

3 从 'graphql/tsutils/Maybe' 导入 Maybe;

@nestjs/graphql": "^7.3.7",
"apollo-server-express": "^2.13.1",
"graphql": "^15.1.0",
"graphql-tools": "^5.0.0",
"graphql-type-json": "^0.3.1",
"@types/graphql": "^14.5.0"
Run Code Online (Sandbox Code Playgroud)

graphql nestjs

5
推荐指数
1
解决办法
5772
查看次数

如何使用 DTO 将响应设置为 swagger 响应中的数组

some-dto.ts

    export class CreateCatDto {
      @ApiProperty()
      name: string;

      @ApiProperty()
      age: number;

      @ApiProperty()
      breed: string;
    }
Run Code Online (Sandbox Code Playgroud)

我不想要这样的回应:

  @ApiOkResponse(
      description: 'Cat object',
      type: CreateCatDto
    )
Run Code Online (Sandbox Code Playgroud)

但我的回应必须是像 dto 对象的数组。我想要 smth 像 soo

    ApiOkResponse(
          description: 'The record has been successfully removed.',
          schema: {
            type: 'array',
            properties: {
              obj: {
                type: CreateCatDto
              }
            }
          }
        )
Run Code Online (Sandbox Code Playgroud)

nestjs nestjs-swagger

4
推荐指数
3
解决办法
1987
查看次数

如何通过缓存管理器检索存储在内存缓存中的所有数据

我使用缓存管理器作为内存中数据存储,如文档https://docs.nestjs.com/techniques/caching https://www.npmjs.com/package/cache-manager中所述

有没有可能的方法来检索所有数据作为示例

const value = this.cacheManager.getall();
Run Code Online (Sandbox Code Playgroud)

node.js nestjs

2
推荐指数
1
解决办法
4410
查看次数

Rtrim不起作用

无论我做什么,帮助rtrim都行不通.我还尝试在","之后添加空格,就像我在这里搜索的主题之一一样

$this->items = array();
$xcount='(';
foreach ($items as $v) {
   $this->items[$v['id']] = $v;
   $xcount.=$v['id'].',';
};
rtrim($xcount, ",");

$xcount.=')';
Run Code Online (Sandbox Code Playgroud)

php

1
推荐指数
1
解决办法
2296
查看次数

RedisIoAdapter 没有调用签名

在实现 RedisIoAdapter 如何在https://docs.nestjs.com/websockets/adapter 中进行描述后,我试图将 socket.io-redis 作为调度程序

import { IoAdapter } from '@nestjs/platform-socket.io';
import * as redisIoAdapter from 'socket.io-redis';

export class RedisIoAdapter extends IoAdapter {
  createIOServer(port: number, options?: any): any {
    const server = super.createIOServer(port, options);
    const redisAdapter = redisIoAdapter({ host: 'localhost', port: 6379 });

    server.adapter(redisAdapter);
    return server;
  }
}
Run Code Online (Sandbox Code Playgroud)

出现错误redisIoAdapter此表达式不可调用。

"socket.io-redis": "^6.0.1"
"@nestjs/platform-socket.io": "^7.6.4",
"@nestjs/websockets": "^7.6.4",
Run Code Online (Sandbox Code Playgroud)

javascript socket.io nestjs

1
推荐指数
1
解决办法
569
查看次数

标签 统计

nestjs ×4

graphql ×1

javascript ×1

nestjs-swagger ×1

node.js ×1

php ×1

socket.io ×1