Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import createEmotionServer from 'create-emotion-server'
import { EmotionCache } from 'emotion'
declare const cache: EmotionCache
// $ExpectType EmotionServer
createEmotionServer(cache)
// $ExpectError
createEmotionServer()
const emotionServer = createEmotionServer(cache)
// $ExpectType EmotionCritical
emotionServer.extractCritical('<div></div>')
// $ExpectError
emotionServer.extractCritical()
// $ExpectError
emotionServer.extractCritical('<div></div>', undefined as any)
// $ExpectType string
emotionServer.renderStylesToString('<div></div>')
// $ExpectError
emotionServer.renderStylesToString()
import createEmotionServer from 'create-emotion-server'
import { EmotionCache } from 'emotion'
declare const cache: EmotionCache
// $ExpectType EmotionServer
createEmotionServer(cache)
// $ExpectError
createEmotionServer()
const emotionServer = createEmotionServer(cache)
// $ExpectType EmotionCritical
emotionServer.extractCritical('<div></div>')
// $ExpectError
emotionServer.extractCritical()
// $ExpectError
emotionServer.extractCritical('<div></div>', undefined as any)
// $ExpectType string
emotionServer.renderStylesToString('<div></div>')
// $ExpectError
emotionServer.renderStylesToString()
// $ExpectError
emotionServer.renderStylesToString('<div></div>', undefined as any)
// $ExpectType ReadWriteStream
// @flow
import createEmotionServer from 'create-emotion-server'
import { cache } from 'emotion'
export const {
extractCritical,
renderStylesToString,
renderStylesToNodeStream
} = createEmotionServer(cache)
opts => {
let cache = createCache()
if (opts.cache) {
cache = opts.cache()
}
let { renderStylesToString } = createEmotionServer(cache)
expect(
renderStylesToString(
renderToString(
{opts.render()}
)
)
).toMatchSnapshot()
},
cases
.add('css prop compat with random', () => {
let cache = createCache()
createEmotionServer(cache).renderStylesToString(
renderToString(
React.createElement(
CacheProvider,
{ value: cache },
React.createElement(CssPropTriangle, {
s: 100,
x: 0,
y: 0,
random: Math.random()
})
)
)
)
})
.add('css func with random', () => {