使用facebook的参考库,我发现了一种破解通用类型的方法,如下所示:
type PagedResource<Query, Item> = (pagedQuery: PagedQuery<Query>) => PagedResponse<Item>
?
interface PagedQuery<Query> {
query: Query;
take: number;
skip: number;
}
?
interface PagedResponse<Item> {
items: Array<Item>;
total: number;
}
Run Code Online (Sandbox Code Playgroud)
function pagedResource({type, resolve, args}) {
return {
type: pagedType(type),
args: Object.assign(args, {
page: { type: new GraphQLNonNull(pageQueryType()) }
}),
resolve
};
function pageQueryType() {
return new GraphQLInputObjectType({
name: 'PageQuery',
fields: {
skip: { type: new GraphQLNonNull(GraphQLInt) },
take: { type: new GraphQLNonNull(GraphQLInt) }
}
});
}
function pagedType(type) {
return new …Run Code Online (Sandbox Code Playgroud) 我有这个记录:
interface TheRecord extends TheRecordType {
a: { typeA: 'string' },
b: { typeB: 123 },
c: { typeA: 'string' },
}
type TheRecordType = Record<string, TypeA | TypeB>
type TypeA = { typeA: string }
type TypeB = { typeB: number }
Run Code Online (Sandbox Code Playgroud)
我希望我的函数只接受值为 typeA 的键
doStuff('b'); //this should fail
function doStuff(arg: keyof FilteredForTypeA): void {
...
}
Run Code Online (Sandbox Code Playgroud)
这是我尝试过滤掉它们的方法
type FilteredForTypeA = { [k in keyof TheRecord]: TheRecord[k] extends TypeA ? TheRecord[k] : never }
Run Code Online (Sandbox Code Playgroud) generics types generic-programming typescript typescript-generics
我想在Laravel中重新加载我的项目的自定义类,以便它们可以访问,但是在共享主机环境中.据我所知,到目前为止,在本地,我已经通过使用此命令实现了所需:
composer dump-autoload
Run Code Online (Sandbox Code Playgroud)
然而,通过putty的SSH运行它给了我:
-bash: composer: command not found
Run Code Online (Sandbox Code Playgroud)
任何的想法?
cordova build --device --releasepilot upload -i platforms/ios/build/device/AskPal.ipa --verbose使用Fastlane Pilot的发布过程失败了:
错误ITMS-90086:"缺少64位支持.提交到App Store的iOS应用程序必须包含64位支持,并使用iOS 8 SDK或更高版本构建.我们建议使用"架构"的默认"标准架构"构建设置"在Xcode中,构建一个具有32位和64位支持的单个二进制文件."
我正在"修复"这个方法是从Cordova删除ios平台,然后重新安装它coordova platform add ios.
请告诉我有一种方法可以在Cordova配置中指定那些构建体系结构.
composer-php ×1
cordova ×1
fastlane ×1
generics ×1
graphql ×1
graphql-js ×1
ios ×1
laravel ×1
ssh ×1
types ×1
typescript ×1