chore: replace .d.ts type imports with .js imports, as .d.ts imports break usage checks in the IDE

This commit is contained in:
Alessio Gravili
2024-03-07 16:08:49 -05:00
parent b4434a369b
commit 50c7269315
562 changed files with 916 additions and 924 deletions

View File

@@ -1,7 +1,7 @@
import type { PayloadRequest } from 'payload/types'
import type { Collection, Field, RichTextField } from 'payload/types'
import type { AdapterArguments } from '../types.d.ts'
import type { AdapterArguments } from '../types.js'
type Arguments = {
currentDepth?: number

View File

@@ -1,6 +1,6 @@
import type { PayloadRequest, RichTextAdapter, RichTextField } from 'payload/types'
import type { AdapterArguments } from '../types.d.ts'
import type { AdapterArguments } from '../types.js'
import { populate } from './populate.js'
import { recurseNestedFields } from './recurseNestedFields.js'

View File

@@ -1,6 +1,6 @@
import type { RichTextField, Validate } from 'payload/types'
import type { AdapterArguments } from '../types.d.ts'
import type { AdapterArguments } from '../types.js'
import { defaultRichTextValue } from './defaultValue.js'

View File

@@ -14,8 +14,8 @@ import { Node, Element as SlateElement, Text, Transforms, createEditor } from 's
import { withHistory } from 'slate-history'
import { Editable, Slate, withReact } from 'slate-react'
import type { ElementNode, RichTextPlugin, TextNode } from '../types.d.ts'
import type { EnabledFeatures } from './types.d.ts'
import type { ElementNode, RichTextPlugin, TextNode } from '../types.js'
import type { EnabledFeatures } from './types.js'
import { defaultRichTextValue } from '../data/defaultValue.js'
import { richTextValidate } from '../data/validation.js'

View File

@@ -1,4 +1,4 @@
import type { EnabledFeatures } from './types.d.ts'
import type { EnabledFeatures } from './types.js'
export const createFeatureMap = (
richTextComponentMap: Map<string, React.ReactNode>,

View File

@@ -5,7 +5,7 @@ import { Tooltip } from '@payloadcms/ui'
import React, { useCallback, useState } from 'react'
import { useSlate } from 'slate-react'
import type { ButtonProps } from './types.d.ts'
import type { ButtonProps } from './types.js'
import '../buttons.scss'
import { isElementActive } from './isActive.js'

View File

@@ -3,7 +3,7 @@
import React, { useCallback } from 'react'
import { useSlate } from 'slate-react'
import type { ButtonProps } from './types.d.ts'
import type { ButtonProps } from './types.js'
import '../buttons.scss'
import { isListActive } from './isListActive.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { BlockquoteIcon } from '../../icons/Blockquote/index.js'
import { ElementButton } from '../Button.js'

View File

@@ -2,7 +2,7 @@ import type { NodeEntry, NodeMatch } from 'slate'
import { Editor, Node } from 'slate'
import type { ElementNode } from '../../types.d.ts'
import type { ElementNode } from '../../types.js'
import { isBlockElement } from './isBlockElement.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { H1Icon } from '../../icons/headings/H1/index.js'
import { ElementButton } from '../Button.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { H2Icon } from '../../icons/headings/H2/index.js'
import { ElementButton } from '../Button.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { H3Icon } from '../../icons/headings/H3/index.js'
import { ElementButton } from '../Button.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { H4Icon } from '../../icons/headings/H4/index.js'
import { ElementButton } from '../Button.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { H5Icon } from '../../icons/headings/H5/index.js'
import { ElementButton } from '../Button.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { H6Icon } from '../../icons/headings/H6/index.js'
import { ElementButton } from '../Button.js'

View File

@@ -5,7 +5,7 @@ import { useCallback } from 'react'
import { Editor, Element, Text, Transforms } from 'slate'
import { ReactEditor, useSlate } from 'slate-react'
import type { ElementNode } from '../../../types.d.ts'
import type { ElementNode } from '../../../types.js'
import { IndentLeft } from '../../icons/IndentLeft/index.js'
import { IndentRight } from '../../icons/IndentRight/index.js'

View File

@@ -1,4 +1,4 @@
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { IndentButton } from './Button.js'
import { IndentElement } from './Element.js'

View File

@@ -1,4 +1,4 @@
import type { RichTextCustomElement } from '../../types.d.ts'
import type { RichTextCustomElement } from '../../types.js'
import { blockquote } from './blockquote/index.js'
import { h1 } from './h1/index.js'

View File

@@ -2,7 +2,7 @@ import type { Element } from 'slate'
import { Editor, Transforms } from 'slate'
import type { ElementNode } from '../../types.d.ts'
import type { ElementNode } from '../../types.js'
import { isLastSelectedElementEmpty } from './isLastSelectedElementEmpty.js'

View File

@@ -1,4 +1,4 @@
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { ListItemElement } from './ListItem.js'

View File

@@ -22,7 +22,7 @@ import React, { useCallback, useEffect, useState } from 'react'
import { Editor, Node, Transforms } from 'slate'
import { ReactEditor, useSlate } from 'slate-react'
import type { LinkElementType } from '../types.d.ts'
import type { LinkElementType } from '../types.js'
import { useElement } from '../../../providers/ElementProvider.js'
import { LinkDrawer } from '../LinkDrawer/index.js'

View File

@@ -17,7 +17,7 @@ import { FieldPathProvider } from '@payloadcms/ui/forms'
import { useHotkey } from '@payloadcms/ui/hooks'
import React, { useCallback, useRef } from 'react'
import type { Props } from './types.d.ts'
import type { Props } from './types.js'
import { linkFieldsSchemaPath } from '../shared.js'
import './index.scss'

View File

@@ -1,4 +1,4 @@
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { LinkButton } from './Button/index.js'
import { LinkElement } from './Element/index.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { OLIcon } from '../../icons/OrderedList/index.js'
import { ListButton } from '../ListButton.js'

View File

@@ -15,7 +15,7 @@ import React, { useCallback, useReducer, useState } from 'react'
import { Transforms } from 'slate'
import { ReactEditor, useFocused, useSelected, useSlateStatic } from 'slate-react'
import type { RelationshipElementType } from '../types.d.ts'
import type { RelationshipElementType } from '../types.js'
import { useElement } from '../../../providers/ElementProvider.js'
import { EnabledRelationshipsCondition } from '../../EnabledRelationshipsCondition.js'

View File

@@ -1,4 +1,4 @@
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { Button } from './Button/index.js'
import { Element } from './Element/index.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { AlignCenterIcon } from '../../icons/AlignCenter/index.js'
import { AlignLeftIcon } from '../../icons/AlignLeft/index.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { ULIcon } from '../../icons/UnorderedList/index.js'
import { ListButton } from '../ListButton.js'

View File

@@ -23,7 +23,7 @@ import React, { useCallback, useEffect, useState } from 'react'
import { Transforms } from 'slate'
import { ReactEditor, useSlateStatic } from 'slate-react'
import type { UploadElementType } from '../../types.d.ts'
import type { UploadElementType } from '../../types.js'
import { uploadFieldsSchemaPath } from '../../shared.js'

View File

@@ -20,7 +20,7 @@ import React, { useCallback, useReducer, useState } from 'react'
import { Transforms } from 'slate'
import { ReactEditor, useFocused, useSelected, useSlateStatic } from 'slate-react'
import type { UploadElementType } from '../types.d.ts'
import type { UploadElementType } from '../types.js'
import { useElement } from '../../../providers/ElementProvider.js'
import { EnabledRelationshipsCondition } from '../../EnabledRelationshipsCondition.js'

View File

@@ -1,4 +1,4 @@
import type { RichTextCustomElement } from '../../../types.d.ts'
import type { RichTextCustomElement } from '../../../types.js'
import { Button } from './Button/index.js'
import { Element } from './Element/index.js'

View File

@@ -6,8 +6,8 @@ import { useFieldPath } from '@payloadcms/ui/forms'
import { useClientFunctions } from '@payloadcms/ui/providers'
import React, { Suspense, lazy, useEffect, useState } from 'react'
import type { RichTextPlugin } from '../types.d.ts'
import type { EnabledFeatures } from './types.d.ts'
import type { RichTextPlugin } from '../types.js'
import type { EnabledFeatures } from './types.js'
import { createFeatureMap } from './createFeatureMap.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
import type { RichTextCustomLeaf } from '../../../types.js'
import { BoldIcon } from '../../icons/Bold/index.js'
import { LeafButton } from '../Button.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
import type { RichTextCustomLeaf } from '../../../types.js'
import { CodeIcon } from '../../icons/Code/index.js'
import { LeafButton } from '../Button.js'

View File

@@ -1,4 +1,4 @@
import type { RichTextCustomLeaf } from '../../types.d.ts'
import type { RichTextCustomLeaf } from '../../types.js'
import { bold } from './bold/index.js'
import { code } from './code/index.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
import type { RichTextCustomLeaf } from '../../../types.js'
import { ItalicIcon } from '../../icons/Italic/index.js'
import { LeafButton } from '../Button.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
import type { RichTextCustomLeaf } from '../../../types.js'
import { StrikethroughIcon } from '../../icons/Strikethrough/index.js'
import { LeafButton } from '../Button.js'

View File

@@ -1,6 +1,6 @@
import React from 'react'
import type { RichTextCustomLeaf } from '../../../types.d.ts'
import type { RichTextCustomLeaf } from '../../../types.js'
import { UnderlineIcon } from '../../icons/Underline/index.js'
import { LeafButton } from '../Button.js'

View File

@@ -6,7 +6,7 @@ import { mapFields } from '@payloadcms/ui/utilities'
import { sanitizeFields } from 'payload/config'
import React from 'react'
import type { AdapterArguments, RichTextCustomElement, RichTextCustomLeaf } from './types.d.ts'
import type { AdapterArguments, RichTextCustomElement, RichTextCustomLeaf } from './types.js'
import { elements as elementTypes } from './field/elements/index.js'
import { linkFieldsSchemaPath } from './field/elements/link/shared.js'

View File

@@ -4,7 +4,7 @@ import { initI18n } from '@payloadcms/translations'
import { translations } from '@payloadcms/translations/client'
import { sanitizeFields } from 'payload/config'
import type { AdapterArguments, RichTextCustomElement } from './types.d.ts'
import type { AdapterArguments, RichTextCustomElement } from './types.js'
import { elements as elementTypes } from './field/elements/index.js'
import { linkFieldsSchemaPath } from './field/elements/link/shared.js'

View File

@@ -2,7 +2,7 @@ import type { RichTextAdapter } from 'payload/types'
import { withNullableJSONSchemaType } from 'payload/utilities'
import type { AdapterArguments } from './types.d.ts'
import type { AdapterArguments } from './types.js'
import { RichTextCell } from './cell/index.js'
import { richTextRelationshipPromise } from './data/richTextRelationshipPromise.js'
@@ -77,6 +77,6 @@ export type {
RichTextElement,
RichTextLeaf,
TextNode,
} from './types.d.ts'
} from './types.js'
export { nodeIsTextNode } from './types.js'