小编Eel*_*els的帖子

Cannot add to github: Gist does not support directories

I get the error when trying to push to github:

remote: Gist does not support directories.
remote: These are the directories that are causing problems:
remote: dirname1, dirname2
Run Code Online (Sandbox Code Playgroud)

Looking at other questions, it seems that github doesn't accept empty folders but none of these folders are empty. I can successfully push other files that are inside the root folder of the repository, and can also successfully deploy the app to heroku using git.

How do I add a directory to …

git gist github

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

Typescript:交叉点 - 对命名感到困惑

我对 Typescript 中的“交叉类型”这个名称有点困惑。

在集合论中,交集意味着只有两种类型共有的属性在两者的交集中才可用。

事实上,如果我在基元之间创建交集,这就是 Typescript 的行为方式。

type A = string | number
type B = number | boolean
type C = A & B

type D = string
type E = number
type F = D & B
Run Code Online (Sandbox Code Playgroud)

在这种情况下,TS 推断Cnumber和。Fnever

在此输入图像描述在此输入图像描述

然而,当涉及到对象时,创建交集会创建一个新的类型/接口,它结合了所使用类型的属性 -

在此输入图像描述在此输入图像描述

从文档中

TypeScript 提供了另一种称为交集类型的构造,主要用于组合现有的对象类型

当您以这种方式看待时,对象的行为就非常有意义了。而且使用&也有意义。

所以,我的问题是:

  1. 为什么对象和基元的行为看起来不同?
  2. 为什么选择“交叉点”这个名字?

也许它与联合类型的解释有某种关系?

在此输入图像描述

type-theory set-theory typescript

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

标签 统计

gist ×1

git ×1

github ×1

set-theory ×1

type-theory ×1

typescript ×1