Skip to content

Commit

Permalink
chore(form-builder): use strict mode for transitional components
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Apr 8, 2021
1 parent d12ad80 commit 1902832
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import React from 'react'
import React, {ComponentProps} from 'react'
import {Button} from '@sanity/ui'
import {useRouter} from '../legacyParts'

export function IntentButton(props) {
export function IntentButton(
props: Omit<ComponentProps<typeof Button>, 'href'> & {
intent: string
params: Record<string, string>
}
) {
const router = useRouter()

return <Button {...props} as="a" href={router.resolveIntentLink(props.intent, props.params)} />
Expand Down
6 changes: 4 additions & 2 deletions packages/@sanity/form-builder/src/transitional/IntentLink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react'
import React, {ComponentProps} from 'react'
import {useRouter} from '../legacyParts'

export function IntentLink(props) {
export function IntentLink(
props: Omit<ComponentProps<'a'>, 'href'> & {intent: string; params: Record<string, string>}
) {
const router = useRouter()

return <a {...props} href={router.resolveIntentLink(props.intent, props.params)} />
Expand Down
3 changes: 3 additions & 0 deletions packages/@sanity/form-builder/src/transitional/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// this conditionally enables strict mode for everything in this folder
// (Note: only applies to the typescript compiler service, not when using tsc for build)
{"extends": "../../tsconfig.strict"}

2 comments on commit 1902832

@vercel
Copy link

@vercel vercel bot commented on 1902832 Apr 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio.sanity.build
test-studio-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 1902832 Apr 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

perf-studio – ./

perf-studio.sanity.build
perf-studio-git-next.sanity.build

Please sign in to comment.