Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
bb8a49ec
Unverified
Commit
bb8a49ec
authored
Nov 04, 2020
by
Joe Haddad
Committed by
GitHub
Nov 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Omit ignored property from <Image/ > to prevent confusion (#18796)
Fixes #18793
parent
37ed2d23
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
1 deletion
+63
-1
image.tsx
packages/next/client/image.tsx
+1
-1
next.config.js
...tegration/image-component/typescript-style/next.config.js
+5
-0
invalid.tsx
...ration/image-component/typescript-style/pages/invalid.tsx
+19
-0
index.test.js
...ation/image-component/typescript-style/test/index.test.js
+19
-0
tsconfig.json
...ntegration/image-component/typescript-style/tsconfig.json
+19
-0
No files found.
packages/next/client/image.tsx
View file @
bb8a49ec
...
@@ -32,7 +32,7 @@ type ImageData = {
...
@@ -32,7 +32,7 @@ type ImageData = {
type
ImageProps
=
Omit
<
type
ImageProps
=
Omit
<
JSX
.
IntrinsicElements
[
'img'
],
JSX
.
IntrinsicElements
[
'img'
],
'src'
|
'srcSet'
|
'ref'
|
'width'
|
'height'
|
'loading'
'src'
|
'srcSet'
|
'ref'
|
'width'
|
'height'
|
'loading'
|
'style'
>
&
{
>
&
{
src
:
string
src
:
string
quality
?:
number
|
string
quality
?:
number
|
string
...
...
test/integration/image-component/typescript-style/next.config.js
0 → 100644
View file @
bb8a49ec
module
.
exports
=
{
images
:
{
domains
:
[
'via.placeholder.com'
],
},
}
test/integration/image-component/typescript-style/pages/invalid.tsx
0 → 100644
View file @
bb8a49ec
import
React
from
'react'
import
Image
from
'next/image'
const
Invalid
=
()
=>
{
return
(
<
div
>
<
h1
>
Invalid TS
</
h1
>
<
Image
width=
{
500
}
height=
{
500
}
src=
"https://via.placeholder.com/500"
style=
{
{
objectFit
:
'cover'
}
}
></
Image
>
<
p
id=
"stubtext"
>
This is the invalid usage
</
p
>
</
div
>
)
}
export
default
Invalid
test/integration/image-component/typescript-style/test/index.test.js
0 → 100644
View file @
bb8a49ec
/* eslint-env jest */
import
{
nextBuild
}
from
'next-test-utils'
import
{
join
}
from
'path'
jest
.
setTimeout
(
1000
*
60
*
2
)
const
appDir
=
join
(
__dirname
,
'..'
)
describe
(
'TypeScript Image Component with Styles'
,
()
=>
{
describe
(
'next build'
,
()
=>
{
it
(
'should fail to build when the `style` prop is passed to <Image />'
,
async
()
=>
{
const
{
stderr
,
code
}
=
await
nextBuild
(
appDir
,
[],
{
stderr
:
true
})
expect
(
stderr
).
toMatch
(
/Failed to compile/
)
expect
(
stderr
).
toMatch
(
/Property 'style' does not exist on type/
)
expect
(
code
).
toBe
(
1
)
})
})
})
test/integration/image-component/typescript-style/tsconfig.json
0 → 100644
View file @
bb8a49ec
{
"compilerOptions"
:
{
"esModuleInterop"
:
true
,
"module"
:
"esnext"
,
"jsx"
:
"preserve"
,
"target"
:
"es5"
,
"lib"
:
[
"dom"
,
"dom.iterable"
,
"esnext"
],
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
true
,
"forceConsistentCasingInFileNames"
:
true
,
"noEmit"
:
true
,
"moduleResolution"
:
"node"
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
},
"exclude"
:
[
"node_modules"
],
"include"
:
[
"next-env.d.ts"
,
"components"
,
"pages"
]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment