我想导入模型的接口,同时从该文件导出模型接口。
我编写了以下代码来导入模型的接口并在该文件中使用它并将该接口导出到外部。
// api/service/post.interface.ts
export import { Post } from '../../model/interface/post.interface.ts;
// -> An import declaration cannot have modifiers.
type PostPayload = Partial<Post>;
// api/service/post_create.ts
import { Post } from './post.interface';
// -> this path has no exported member 'Post'
const a = (title: Post['title']) => {
...
}
Run Code Online (Sandbox Code Playgroud)
我犯了什么错误?
我正在使用 Beanstalk 和 Codepipeline。
它在构建之前工作正常,但是
部署失败。提供的角色没有足够的权限:无法部署应用程序。服务:AWSLogs,消息:用户:arn:aws:sts::::assumed-role/pipeline-role/ 未被授权执行:logs:CreateLogGroup on resource:arn:aws:logs:ap-northeast-2::log -group:/aws/elasticbeanstalk/repo-env/var/log/nginx/error.log:log-stream:
发生在 Beanstalk 部署中。
我需要日志组的权限吗?
我的 Codepipeline 角色是
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"opsworks:DescribeStacks",
"devicefarm:GetRun",
"rds:*",
"cloudformation:CreateChangeSet",
"autoscaling:*",
"codebuild:BatchGetBuilds",
"devicefarm:ScheduleRun",
"servicecatalog:ListProvisioningArtifacts",
"devicefarm:ListDevicePools",
"cloudformation:UpdateStack",
"servicecatalog:DescribeProvisioningArtifact",
"cloudformation:DescribeChangeSet",
"devicefarm:ListProjects",
"cloudformation:ExecuteChangeSet",
"sns:*",
"lambda:ListFunctions",
"lambda:InvokeFunction",
"codedeploy:RegisterApplicationRevision",
"devicefarm:CreateUpload",
"cloudformation:*",
"opsworks:DescribeDeployments",
"cloudformation:DescribeStacks",
"codecommit:GetUploadArchiveStatus",
"cloudwatch:*",
"cloudformation:DeleteStack",
"opsworks:DescribeInstances",
"ecs:*",
"ecr:DescribeImages",
"ec2:*",
"codebuild:StartBuild",
"cloudformation:ValidateTemplate",
"opsworks:DescribeApps",
"opsworks:UpdateStack",
"codedeploy:CreateDeployment",
"codedeploy:GetApplicationRevision",
"codedeploy:GetDeploymentConfig",
"servicecatalog:CreateProvisioningArtifact",
"sqs:*",
"cloudformation:DeleteChangeSet",
"codecommit:GetCommit",
"servicecatalog:DeleteProvisioningArtifact",
"codedeploy:GetApplication",
"cloudformation:SetStackPolicy",
"codecommit:UploadArchive",
"s3:*",
"elasticloadbalancing:*",
"codecommit:CancelUploadArchive",
"devicefarm:GetUpload",
"elasticbeanstalk:*",
"opsworks:UpdateApp",
"opsworks:CreateDeployment", …Run Code Online (Sandbox Code Playgroud) 我们知道必须存在密钥对才能访问 EC2 实例。
我在创建EC2时已经创建了密钥对,但是我看到了“我可以使用现有密钥对”的短语。
这是否意味着如果您使用现有的密钥对,您可以使用一个密钥对访问多个实例?
我有以下组件
成分
<template>
<!--<post-form/>-->
<div class="wrapper">
<b-table :data="posts">
<template slot-scope="props">
<b-table-column field="completed" label="complete">
<b-checkbox
v-model="props.row.done">
</b-checkbox>
</b-table-column>
</template>
</b-table>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
我有一个带buefy的b表。我想<post-form />从当前组件导入组件。
但是,当我将组件插入所需位置时,会发生错误。
<div class="wrapping"> 如果我在它下面放置一个组件,我的桌子就会坏掉。
我该如何解决这个问题?
我想使用模型中定义的接口作为函数的参数。
// model/interface.ts
import { Document } from 'mongoose';
export interface Post extends Document {
location: {
type: string;
coordinates: number[];
};
};
// service/post_create.ts
import { Post } from '../../model/interface/post';
const exec = async (location: Pick<Post, 'location'>) => {
const { coordinates: [x, y] } = location;
// -> Property 'coordinates' does not exists on type 'Pick<Post, 'location'>'
}
Run Code Online (Sandbox Code Playgroud)
我已经通过 Pick 指定了一个类型,我已导入该类型以使用接口作为函数参数,但我实际上无法在函数内找到名为“坐标”的属性。
我犯了什么错误?