dprint-plugin-typescript icon indicating copy to clipboard operation
dprint-plugin-typescript copied to clipboard

Option for functional programming style type declarations

Open scarf005 opened this issue 2 years ago • 1 comments

I'm aware this might be a niche style, so it's perfectly okay if this suggestion is declined. However, I'm interested in how I could implement type declarations in the style of Haskell or other functional programming languages with dprint. Here's what I had in mind:

  1. NewLineAfterTypeInFunctionDeclaration
const add
    : (a: number) => (b: number) => number = (a) => (b) => a + b
  1. NewLineBeforeInitializerInVariableDeclaration
const add : (a: number) => (b: number) => number
    = (a) => (b) => a + b
  1. Using both
const add
    : (a: number) => (b: number) => number
    = (a) => (b) => a + b

Any pointers on where to start or which parts of the codebase I should look into would be greatly appreciated. Thanks!

scarf005 avatar Jul 30 '23 00:07 scarf005

Have a look at https://github.com/dprint/dprint-plugin-typescript/pull/396

adrian-gierakowski avatar Jul 30 '23 06:07 adrian-gierakowski