File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
src/Data/Aeson/TypeScript Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 11# Change log
22
3+ ## Unreleased
4+
5+ * Apply ` typeNameModifier ` to type names emitted on the RHS of fields within interfaces, for consistency.
36
47## 0.6.0.0
58
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ formatTSDeclaration (FormattingOptions {..}) (TSInterfaceDeclaration interfaceNa
4141 ls = T. intercalate " \n " $ [indentTo numIndentSpaces (T. pack (formatTSField member <> " ;" )) | member <- members]
4242 modifiedInterfaceName = (\ (li, name) -> li <> interfaceNameModifier name) . splitAt 1 $ interfaceName
4343
44+ formatTSField :: TSField -> String
45+ formatTSField (TSField optional name typ maybeDoc) = makeDocPrefix maybeDoc <> [i |#{name}#{if optional then ("?" :: String) else ""}: #{typeNameModifier typ}|]
46+
4447formatTSDeclaration _ (TSRawDeclaration text) = text
4548
4649indentTo :: Int -> T. Text -> T. Text
@@ -89,9 +92,6 @@ validateFormattingOptions options@FormattingOptions{..} decls
8992 -- Units (data U = U) contain two declarations, and thus are invalid
9093 isPlainSumType ds = (not . any isInterface $ ds) && length ds == 1
9194
92- formatTSField :: TSField -> String
93- formatTSField (TSField optional name typ maybeDoc) = makeDocPrefix maybeDoc <> [i |#{name}#{if optional then ("?" :: String) else ""}: #{typ}|]
94-
9595makeDocPrefix :: Maybe String -> String
9696makeDocPrefix maybeDoc = case maybeDoc of
9797 Nothing -> " "
You can’t perform that action at this time.
0 commit comments