我正在尝试使用react-docgen-typescript-loader
TypeScript Props 在 Storybook 中生成道具文档,但它不会将任何内容填充到插件中withInfo
。
我正在使用 create-react-app 的 TypeScript 风格,并且遵循多种不同的配置方法,.storybook/webpack.config.js
但似乎没有任何效果。
这是我当前的配置:
module.exports = ({ config, mode }) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: require.resolve('babel-loader'),
options: {
presets: [['react-app', { flow: false, typescript: true }]],
}
},
require.resolve("react-docgen-typescript-loader"),
]
});
config.resolve.extensions.push('.ts', '.tsx');
return config;
};
Run Code Online (Sandbox Code Playgroud)
import { configure } from '@storybook/react';
// automatically import all files ending in *.stories.js
const req = require.context('../', true, /.stories.tsx$/);
function loadStories() {
req.keys().forEach(filename => …
Run Code Online (Sandbox Code Playgroud) 我试图了解副本分配构造函数在c ++中的工作方式。我只使用过Java,所以我真的不在这里。我已经阅读并看到返回引用是一种很好的做法,但是我不知道该怎么做。我写了这个小程序来测试这个概念:
main.cpp:
#include <iostream>
#include "test.h"
using namespace std;
int main() {
Test t1,t2;
t1.setAge(10);
t1.setId('a');
t2.setAge(20);
t2.setId('b');
cout << "T2 (before) : " << t2.getAge() << t2.getID() << "\n";
t2 = t1; // calls assignment operator, same as t2.operator=(t1)
cout << "T2 (assignment operator called) : " << t2.getAge() << t2.getID() << "\n";
Test t3 = t1; // copy constr, same as Test t3(t1)
cout << "T3 (copy constructor using T1) : " << t3.getAge() << t3.getID() << …
Run Code Online (Sandbox Code Playgroud) Ok, SwiftUI was released this week so we're all n00bs but... I have the following test code:
var body: some View {
switch shape {
case .oneCircle:
return ZStack {
Circle().fill(Color.red)
}
case .twoCircles:
return ZStack {
Circle().fill(Color.green)
Circle().fill(Color.blue)
}
}
}
Run Code Online (Sandbox Code Playgroud)
which produces the following error:
Function declares an opaque return type, but the return statements in its body do not have matching underlying types
This happens because the first ZStack is this type:
ZStack<ShapeView<Circle, Color>>
Run Code Online (Sandbox Code Playgroud)
and the second …
我有一个obs
具有间隔的可观察量125*variable
,每 0.125 秒完成一个动作。的值variable
将在我的程序中动态变化。
obs = interval(125*variable).pipe(
takeWhile(() => this.t < moment('2019-04-16T18:00:00')),
tap(() => {
if (!this.isPaused) {
this.t.add(1, 'minutes'); this.time = this.t.format('LLL');
}
}),
map(() => moment(this.time))
);
Run Code Online (Sandbox Code Playgroud)
如何更改可观察值的间隔以使用正确/更新的variable
值?
Why is using componentDidUpdate
more recommended over the setState
callback function (optional second argument) in React components (if synchronous setState behavior is desired)?
Since setState
is asynchronous, I was thinking about using the setState
callback function (2nd argument) to ensure that code is executed after state has been updated, similar to then()
for promises. Especially if I need a re-render in between subsequent setState
calls.
However, the official React Docs say "The second parameter to setState() is an optional callback …
bbb(){
return new Promise((resolve, reject) => {
this.http.get(this.url).subscribe(data => {
resolve(data)
},
error => {
reject(error);
},
);
});
}
ngAfterContentInit(){
console.log(//THIS LINE
this.bbb().then(son => {
return son;
}));
}
Run Code Online (Sandbox Code Playgroud)
- 此行- 在控制台中返回 ZoneAwarePromise。我怎样才能返回儿子的价值?
我正在开发一个项目,其中涉及解析arm elf 文件并从中提取部分。
显然,elf 文件中有很多部分没有加载到闪存中,但我想知道 objcopy 到底如何知道要在二进制文件中包含哪些部分以直接闪存到闪存中?
以arm elf文件的以下readelf为例:
节标题: [Nr] 名称 类型 地址 关闭大小 ES Flg Lk Inf Al
[0] 空 00000000 000000 000000 00 0 0 0
[1] .isr_vector PROGBITS 08020000 010000 0001f8 00 WA 0 0 4
[2].firmware_header_PROGBITS 080201f8 0101f8 000004 00 WA 0 0 4
[3] .text PROGBITS 08020200 010200 01e11c 00 AX 0 0 64
[4] .ARM.extab PROGBITS 0803e31c 033a68 000000 00 W 0 0 1
[5] .exidx ARM_EXIDX 0803e31c 02e31c 000008 00 AL 3 …
我正在尝试将集合传递给VBA函数,但遇到了似乎无法修复的编译错误。
这是给出错误的简化示例。
Sub test()
Dim fooString As String
Dim fooCollection As collection
Set fooCollection = New collection
useString (fooString)
useCollection (fooCollection)
End Sub
Public Function useString(foo As String)
MsgBox ("here")
End Function
Public Function useCollection(foo As collection)
MsgBox ("here")
End Function
Run Code Online (Sandbox Code Playgroud)
我没有看到自己在做的事情与示例所显示的有所不同,例如此处所示的示例:如何对集合进行排序?
这是我得到的错误(编译错误:参数不是可选的):
我正在尝试将 SQS 消息发送到 FIFO 队列。我遇到了消息组 ID 属性的问题。我认为使用 MessageAttributeValue 是设置“MessageGroupId”的正确方法,但 AWS 似乎无法识别此输入。设置 SQS SendMessageRequest.MessageAttributes 的正确方法是什么?
我制作了一个发送消息的控制台项目。我尝试了一些方法来设置消息组 ID 属性,但在发送消息时出现异常。
SendMessageRequest sendMessageRequest = new SendMessageRequest();
sendMessageRequest.QueueUrl = myURL;
MessageAttributeValue mavGroupID = new MessageAttributeValue();
mavGroupID.DataType = "MessageGroupId";
mavGroupID.StringValue = "1";
MessageAttributeValue mavDeDuplicateID = new MessageAttributeValue();
mavDeDuplicateID.DataType = "MessageDeduplicationId";
mavDeDuplicateID.StringValue = "1";
sendMessageRequest.MessageAttributes.Add("0", mavGroupID);
sendMessageRequest.MessageAttributes.Add("1", mavDeDuplicateID);
string sMyMessage = "";
Console.WriteLine();
Console.WriteLine("Message to send: ");
sMyMessage = Console.ReadLine();
sendMessageRequest.MessageBody = sMyMessage;
SendMessageResponse sMR = amazonSQSClient.SendMessage(sendMessageRequest);
Run Code Online (Sandbox Code Playgroud)
Amazon.SQS.AmazonSQSException:“请求必须包含参数 MessageGroupId。”
为什么 git rebase -i 最近会导致头部分离?它曾经用交互式变基的结果来更新我当前的分支。如何获得交互式变基以停止进入分离的 HEAD?
在从远程存储库拉取之前,我总是使用 git rebase -i 来压缩我的提交,以简化处理 git pull 中的任何合并冲突。我不必解决可能多个提交的冲突,而只需解决一个提交。
我使用的示例命令
# git rebase -i <tip of public branch> <my latest commit>
git rebase -i 380647533da 82f5ee67bed
Run Code Online (Sandbox Code Playgroud)
在 vim 中编辑 rebase 交互后:
pick 3ec7c211c49 version1
s 82f5ee67bed some significant refactoring
Run Code Online (Sandbox Code Playgroud)
编辑并保存提交后的输出:
[detached HEAD ea50304796c] version1
Date: Thu Jun 6 17:04:36 2019 -0400
14 files changed, 213 insertions(+), 52 deletions(-)
create mode 100644 some file
create mode 100644 some file
create mode 100644 some file
Successfully rebased …
Run Code Online (Sandbox Code Playgroud)