我在运行故事书时遇到错误...即使是在全新安装的情况下也是如此。
npm run storybook
> @ storybook /media/programmersedge/New_Volume/devs/demostorybook
> start-storybook -p 9001 -c .storybook
sh: 1: start-storybook: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @ storybook: `start-storybook -p 9001 -c .storybook`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @ storybook script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)
我正在使用最新的故事书版本。我的节点 …
假设我有两个枚举,如下面的Typescript中所述,那么我如何合并它们
enum Mammals {
Humans,
Bats,
Dolphins
}
enum Reptiles {
Snakes,
Alligators,
Lizards
}
export default Mammals & Reptiles // For Illustration purpose, Consider both the Enums have been merged.
Run Code Online (Sandbox Code Playgroud)
现在,当我import在exported value另一个文件中,我应该能够从两个枚举访问值.
import animalTypes from "./animalTypes"
animalTypes.Humans //valid
animalTypes.Snakes // valid
Run Code Online (Sandbox Code Playgroud)
如何在Typescript中实现此类功能?
我在玩打字稿一点。
假设我有一个object这样的
let colors = {
RED: "r",
GREEN: "g",
BLUE: "b"
}
Run Code Online (Sandbox Code Playgroud)
现在我想把它转换成一种enum类型
enum Colors = {
RED = "r",
GREEN = "g",
BLUE = "b"
}
Run Code Online (Sandbox Code Playgroud)
更新:
我想要typings为颜色对象生成,这样如果我key向颜色对象添加另一个,它应该包含在typings.
如果我做
colors['YELLOW'] = "y"
Run Code Online (Sandbox Code Playgroud)
那么生成的typings应该是
declare enum colors {
RED = "r",
GREEN = "g",
BLUE = "b",
YELLOW = "y"
}
Run Code Online (Sandbox Code Playgroud)
相反,生成类型是
declare const colors {
[x: string]: string
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我很难理解React.cloneElement()功能的行为
我的组件结构是这样的
A.js
export default class A extends React.Component {
render() {
return (<h1>{ this.props.message }</h1>)
}
}
Run Code Online (Sandbox Code Playgroud)
B.js
import A from "./A"
const newComponent = React.cloneElement(A,{
message: "Hello World"
})
export default newComponent
Run Code Online (Sandbox Code Playgroud)
C.js
import B from "./B"
import { BrowserRouter as Router, Route } from "react-router-dom"
// To Be very precise
export default class C extends React.Component {
render() {
return (
<Router>
<Route path="/" component={B} />
</Router>
)
}
}
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个错误
提供给component类型的无效道具,预期.object …
我正在尝试使用装饰器向类添加一些属性。但我收到编译时错误。我的代码结构有点像这样。
type ModuleConfig = {
ModuleName: string
// ...other properties
}
type ModuleClass = {
ModuleName: string
}
type TargetClass = {}
function Module(moduleConfig: ModuleConfig ): Function {
return function(targetClass: TargetClass): ModuleClass {
Object.defineProperty(targetClass,"ModuleName", { value: moduleConfig.ModuleName })
// ...Define other properties in targetClass based on other properties of moduleConfig.
return <ModuleClass>targetClass
}
}
==================================
@Module({
ModuleName: "App"
// ...other properties
})
class AppModule {}
===================================
let Config = {
RootModule: AppModule,
modules:[
// other Modules
]
}
===================================
type …Run Code Online (Sandbox Code Playgroud) 是否可以将React App的Redux Store作为单独的npm 包开发,然后在React App 中开发Storeimport
例如:我有一个名为reactapp.
我开发了一个名为包reactapp-reduxstore包含Redux的商店,它的操作和减速
现在,我将其导入reactapp-reduxstore到我的reactapp项目中
// other imports
import { store } from 'reactapp-reduxstore'
const ReactApp = () => (
<Provider store={store}>
// React App Components
<Provider/>
)
// Mount ReactApp to DOM
Run Code Online (Sandbox Code Playgroud)
现在,如果我想使用我的redux 存储包中的操作,我会将操作导入到组件中。
import { addUser } from "reactapp-reduxstore/users"
// Use the action in my Component
Run Code Online (Sandbox Code Playgroud)
我只想知道, …
我正在使用laravel/passport password_grant进行身份验证。整个生成access_token和refresh_token过程工作正常。现在我正在尝试使用 Laravel 护照令牌事件来撤销旧令牌。
我参考了这篇文章的过程 - https://laracasts.com/discuss/channels/laravel/laravel-passport-revoke-and-prune-event-listener-is-not-doing-anything
这有效......但是当access token使用先前提供的刷新时refresh token,access token正在创建一个新的并创建一个新的refresh token存在。最终,在撤销 old 时access token, old, not expiredrefresh token也被撤销。
但我认为,refresh token只有在它到期时才必须撤销。
而且当我EventListeners从App\Providers\EventServiceProvider $listen array 中删除时,撤销机制仍然有效。
这就像拔掉插头灯泡仍然亮着一样。
如何解决这个问题?还是我在某个地方的概念有误?
authentication access-token laravel refresh-token laravel-passport
我使用 PHPUnit 9 运行测试,当我这样做时,assertRegExp我收到警告
assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.
Run Code Online (Sandbox Code Playgroud)
如何抑制特定测试的弃用警告?
注意:-我使用 Laravel Dusk 来运行我的测试,并使用测试助手assertPathIs。
如何在Markdown中创建罗马数字列表?
像这样...
i)更高的每英亩甘蔗田。
ii)甘蔗中蔗糖含量较高。
iii)降低人工成本。
iv)更长的破碎时间。
我的Laravel自定义软件包有一个配置文件。
目前,我正在按照docs中所述通过发布自定义包的配置文件来使用它。
我只想澄清一下,有没有一种方法可以使用自定义包的配置文件而不在Laravel 5中发布它?*
laravel ×3
reactjs ×3
typescript ×3
enums ×2
npm ×2
types ×2
access-token ×1
arrays ×1
clone ×1
components ×1
config ×1
decorator ×1
element ×1
javascript ×1
laravel-5 ×1
laravel-dusk ×1
list ×1
markdown ×1
merge ×1
modularity ×1
object ×1
package ×1
phpunit ×1
publish ×1
redux ×1
storybook ×1
testing ×1
yarnpkg ×1