Skip to content

Cannot convert a Symbol value to a string #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
guoerwei opened this issue Sep 7, 2016 · 4 comments
Closed

Cannot convert a Symbol value to a string #303

guoerwei opened this issue Sep 7, 2016 · 4 comments

Comments

@guoerwei
Copy link

guoerwei commented Sep 7, 2016

尝试了在 mutation-types.js 里定义的时候,使用Symbol(),比如SOME_ACTION=Symbol()

在actions里面dispatch会是成功的,

const test = ({dispatch}, action) => { dispatch(SOME_ACTION), action };

但是在非actions里,比如我参考vux,在router那边使用了dispatch来操作。

store.dispatch(SOME_ACTION, param)

这个时候就会报出Cannot convert a Symbol value to a string,如果不用Symbol()就可以

@fnlctrl
Copy link
Member

fnlctrl commented Sep 7, 2016

显然不可以,都提示你不能把symbol转成string了。dispatch第一个参数必须是字符串。

@guoerwei
Copy link
Author

guoerwei commented Sep 7, 2016

 对的,提示是这么提示的,但是感觉这里用Symbol不是挺好的么,为啥要限制String
而且在actions里直接dispatch的时候,用Symbol也是可以工作的

@fnlctrl
Copy link
Member

fnlctrl commented Sep 7, 2016

有道理。。你可以提一个feature request,记得用英文。。

On Wed, Sep 7, 2016, 19:32 guoerwei [email protected] wrote:

对的,提示是这么提示的,但是感觉这里用Symbol不是挺好的么,为啥要限制String
而且在actions里直接dispatch的时候,用Symbol也是可以工作的


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#303 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AFTLlxFwzgWyWUuUtmrHNWNz_L_YORkdks5qnqDIgaJpZM4J2yNz
.

@ktsn
Copy link
Member

ktsn commented Sep 10, 2016

Symbol is not supported because it cannot be serialized. See #224, reduxjs/redux#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants