Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Issues minifying ts2dart #40

@dariajung

Description

@dariajung
  • TypeScript objects not being typed to classes/interfaces defined in typescript.d.ts (in want of more generic/flexible types)
    • ie: n: ts.ModifiersArray vs n: {flags: number} in base.ts line 61
  • Typing problems - if maybeVisitTypeArguments takes a type not externally declared, typeArguments get renamed, but adding a more strict typing like ts.ExpressionWithTypeArguments brings up an error when passed something like an object of type ts.CallExpression
    • error TS2345: Argument of type 'CallExpression' is not assignable to parameter of type 'ExpressionWithTypeArguments'.

Breakage, in cases like these:

return {fileName, qname};

function getFileAndName(): { fileName: string, qname: string } // rename properties here? {
    var fileName = 'hello';
    var qname = 'world';
    return { fileName, qname }; // ShortPropertyAssignment
}

A TypeLiteral node is comprised of

  • First Punctuation
  • SyntaxList
  • CloseBraceToken

SyntaxListis where the interesting bit could happen:

  • PropertySignature
    • Identifier
    • ColonToken
    • StringKeyword

Another scenario:

function getFileAndName(): { fileName: string, qname: string } {
    var fileName = 'hello';
    var blah = 'world';
    return { fileName, qname: blah };
}

The current algorithm contextEmit will rename qname and blah because they are both identifiers, when we only want to rename qname.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions