为什么我可以在视图中为不同的控制器访问一个控制器的辅助方法?有没有办法在没有黑客攻击/修补Rails的情况下禁用它?
我想发布一个包含“模块”类型声明的包*.graphql,并让项目使用该包,以便他们可以import为其他文件中编写的查询编写语句。这可能吗?
这是我到目前为止所拥有的。
我有以下类型,位于名为graphql.d.ts.
declare module '*.graphql' {
import { DocumentNode } from 'graphql';
const Schema: DocumentNode;
export default defaultDocument;
}
Run Code Online (Sandbox Code Playgroud)
而我的package.json长相是这样的。
{
"name": "@my-private-scope/type-graphql-imports",
"version": "1.0.0",
"types": "graphql.d.ts",
"files": [
"graphql.d.ts"
],
"peerDependencies": {
"graphql": ">=14.0.0"
}
}
Run Code Online (Sandbox Code Playgroud)
但是在发布这个包并将其导入到不同的项目中后,出现以下错误。
error TS2307: Cannot find module './query.graphql' or its corresponding type declarations.
有没有办法配置项目以使这些类型对编译器可见?
我用ZenTest和自动测试之前对Ruby项目工作,我曾经使用他们的测试驱动开发一拉此配置.我有一个项目,我目前正在使用Java,我想知道Java世界中是否有类似的东西可以实现相同的效果.