flow-remove-types-no-whitespace
Version:
Removes Flow type annotations from JavaScript files with speed and simplicity.
133 lines (67 loc) • 2.04 kB
JavaScript
/* */
// Regular import
import { Something } from 'some-module';
// Import types
// Typed function
async function test(x , y /*.*/ /*.*/ , z /*.*/ /*.*/ = 123) {
// Typed expression
return await (x );
}
// Interface
// Exported interface
// Interface extends
// Implements interface
class Bar extends Other /*.*/ {
// Class Property with default value
answer = 42;
// Class Property
method() {
return;
}
}
// Class expression implements interface
var SomeClass = class Baz {
method() {
return;
}
};
// Parametric class
class Wrapper {
get() {
return this.value;
}
map () {
// do something
}
}
// Extends Parametric class
class StringWrapper extends Wrapper {
// ...
}
// Declare class
// Declare funtion
// Declare interface
// Declare module
// Declare type alias
// Declare variable
// Type alias
// Export type
// Regular export
export { Wrapper };
// Exported type alias
// Object with types within
var someObj = {
objMethod() {
// do nothing.
}
}
// Example from README
import SomeClass from 'some-module'
export class MyClass extends SomeClass {
constructor(value ) {
this.value = value
}
get() {
return this.value
}
}