-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add support for ES6 symbol types #810
Comments
I did not quite figured out how to add a primitive type support and at this point I don't have enough time to digg into to do it. So I have created this libdef for my use: // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
declare class Symbol {
static (value?:any): symbol;
static for(key:string): symbol;
static keyFor(symbol:symbol): string;
toString(): string;
valueOf(): symbol;
// Well-known symbols
static iterator: symbol;
static match: symbol;
static replace: symbol;
static search: symbol;
static split: symbol;
static hasInstance: symbol;
static isConcatSpreadable: symbol;
static unscopables: symbol;
static species: symbol;
static toPrimitive: symbol;
static toStringTag: symbol;
}
type symbol = Symbol; I'm happy to send a pull to include it into |
Has Symbol.iterator support been implemented? |
This would be really good to have because it is a common use-case with React Redux to use symbols for action namespacing (and slightly better performance, too). Our current codebase massively fouls with flow and we've got a lot of export const SOME_FOO = Symbol('SOME_FOO');
// ...
import { SOME_FOO } from './some/action/type';
export const {
SOME_FOO: doSomeFoo,
// ^ flow error, symbol not supported / can't use as map key
...
} |
Is there any plan to support Symbols? Currently |
Symbols support to be supported |
Code along this lines causes an error:
The text was updated successfully, but these errors were encountered: