Skip to content
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

Typecheck (BREAKING CHANGES) #73

Merged
merged 43 commits into from
Mar 1, 2019
Merged

Typecheck (BREAKING CHANGES) #73

merged 43 commits into from
Mar 1, 2019

Conversation

goodmind
Copy link
Contributor

@goodmind goodmind commented Feb 14, 2019

Probably experimental and shouldn't be merged?

CLI

  • Add --no-module-exports options, it disables declare module.exports syntax in favor of declare export default
  • Add --flow-typed-export [folder] instead of exporting to ../exports folder, it now exports to ./exports and you can change folder name
  • Remove --string-enums flag

Compiler (breaking change?)

  • Use TypeScript typechecker for name resolving

Parser

  • Use transformers to remove legacy syntax with new

    • ImportEqualsTransformer
      Replace import x = require('y') with import * as x from 'y'

    • LegacyModules
      Replace module Identifier {} with namespace Identifier {}
      (don't confuse with declare module 'package-name' {})

  • Use recursive addChildren for nested namespaces

  • Print enums, classes, and nested namespaces identifiers inside namespaces

  • Use Symbol.for('nodejs.util.inspect') for printing nodes in console instead of cloning them

Printers

  • Print empty line for import 'side-effect' in declare module
  • Move literalType printer
  • Move typeParameter printer
  • Move propertyDeclaration printer
  • Replace class enums with simplified object enums, resolve enum and enum members references with typechecker
  • Qualify identifiers inside class and interface (resolve namespaces)
  • Add support for unnamed default export
    export default function(): void;
  • Add support for renaming module identifiers (@types/react should be installed)
From To
import * as React from 'react'
type S = React.ReactNode
import * as React from 'react'
type S = React.Node
import {ReactNode} from 'react'
type S = ReactNode
import type {Node} from 'react'
type S = Node

@goodmind goodmind changed the title Typecheck Typecheck (BREAKING CHANGES) Feb 14, 2019
@orta
Copy link
Collaborator

orta commented Feb 14, 2019

If it's useful, I'm fine with bumping this lib in major semver for it?

@goodmind
Copy link
Contributor Author

goodmind commented Feb 14, 2019

@orta, yeah, probably would be ok, i'm just sure that tests doesn't cover everything and this looks like major shift in implementation

@goodmind
Copy link
Contributor Author

@orta anything preventing merging this?

@orta
Copy link
Collaborator

orta commented Mar 1, 2019

Nope, just me coming back and merging it :D

@orta orta merged commit 5530a2c into joarwilk:master Mar 1, 2019
@orta
Copy link
Collaborator

orta commented Mar 1, 2019

OK, shipped as 1,6,0

@goodmind
Copy link
Contributor Author

goodmind commented Mar 9, 2019

@orta do you mind if I had rights to commit and label issues directly in this repo?

@orta
Copy link
Collaborator

orta commented Mar 9, 2019

I'd prefer it, but I don't have access to give to that access I'm afraid

@FezVrasta
Copy link

Was this ever released? --flow-typed-export tells me it's not a valid option.

@ozyman42
Copy link

Use --flow-typed-format instead of --flow-typed-export

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

Successfully merging this pull request may close these issues.

4 participants