pax_global_header00006660000000000000000000000064141444373500014517gustar00rootroot0000000000000052 comment=15aa9947fc3d2336dc3eba7ed5e61d09909dd37c csstype-3.0.10/000077500000000000000000000000001414443735000132725ustar00rootroot00000000000000csstype-3.0.10/.eslintrc.js000066400000000000000000000012151414443735000155300ustar00rootroot00000000000000module.exports = { root: true, parser: '@typescript-eslint/parser', plugins: ['@typescript-eslint', 'prettier'], extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], ignorePatterns: ['**/*.d.ts'], rules: { '@typescript-eslint/ban-types': 0, '@typescript-eslint/explicit-module-boundary-types': 0, '@typescript-eslint/no-empty-interface': 0, '@typescript-eslint/no-explicit-any': 0, '@typescript-eslint/no-non-null-assertion': 0, '@typescript-eslint/no-var-requires': 0, 'no-empty-pattern': 0, 'no-inner-declarations': 0, 'no-undef': 0, 'prettier/prettier': 2, }, }; csstype-3.0.10/.flowconfig000066400000000000000000000004351414443735000154320ustar00rootroot00000000000000[ignore] .*/node_modules/.* .*/__fixtures__/.* [include] [libs] [lints] untyped-import=warn [options] [strict] sketchy-null sketchy-number untyped-type-import unclear-type unsafe-getters-setters nonstrict-import unnecessary-optional-chain unnecessary-invariant deprecated-utility csstype-3.0.10/.gitattributes000066400000000000000000000000571414443735000161670ustar00rootroot00000000000000index.d.ts merge=ours index.js.flow merge=ours csstype-3.0.10/.gitignore000066400000000000000000000000161414443735000152570ustar00rootroot00000000000000node_modules/ csstype-3.0.10/.prettierignore000066400000000000000000000001131414443735000163300ustar00rootroot00000000000000index.js.flow index.d.ts package.json package-lock.json src/data/urls.json csstype-3.0.10/.prettierrc000066400000000000000000000001431414443735000154540ustar00rootroot00000000000000{ "arrowParens": "avoid", "printWidth": 120, "singleQuote": true, "trailingComma": "all" } csstype-3.0.10/.travis.yml000066400000000000000000000000511414443735000153770ustar00rootroot00000000000000language: node_js node_js: - 'stable' csstype-3.0.10/.vscode/000077500000000000000000000000001414443735000146335ustar00rootroot00000000000000csstype-3.0.10/.vscode/launch.json000066400000000000000000000006021414443735000167760ustar00rootroot00000000000000{ "configurations": [ { "type": "node", "name": "vscode-jest-tests", "request": "launch", "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "disableOptimisticBPs": true, "cwd": "${workspaceFolder}", "runtimeExecutable": "npm", "args": ["run", "test", "--", "--runInBand", "--watchAll=false"] } ] } csstype-3.0.10/.vscode/settings.json000066400000000000000000000005421414443735000173670ustar00rootroot00000000000000{ "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "editor.formatOnSave": true, "eslint.alwaysShowStatus": true, "eslint.validate": ["javascript", "javascriptreact", "html", "typescript", "typescriptreact"], "files.eol": "\n", "typescript.tsdk": "node_modules/typescript/lib", "jest.jestCommandLine": "npm run test --" } csstype-3.0.10/LICENSE000066400000000000000000000020461414443735000143010ustar00rootroot00000000000000Copyright (c) 2017-2018 Fredrik Nicol Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. csstype-3.0.10/README.md000066400000000000000000000240621414443735000145550ustar00rootroot00000000000000# CSSType [![npm](https://img.shields.io/npm/v/csstype.svg)](https://www.npmjs.com/package/csstype) TypeScript and Flow definitions for CSS, generated by [data from MDN](https://github.com/mdn/data). It provides autocompletion and type checking for CSS properties and values. **TypeScript** ```ts import * as CSS from 'csstype'; const style: CSS.Properties = { colour: 'white', // Type error on property textAlign: 'middle', // Type error on value }; ``` **Flow** ```js // @flow strict import * as CSS from 'csstype'; const style: CSS.Properties<> = { colour: 'white', // Type error on property textAlign: 'middle', // Type error on value }; ``` _Further examples below will be in TypeScript!_ ## Getting started ```sh $ npm install csstype ``` ## Table of content - [Style types](#style-types) - [At-rule types](#at-rule-types) - [Pseudo types](#pseudo-types) - [Generics](#generics) - [Usage](#usage) - [What should I do when I get type errors?](#what-should-i-do-when-i-get-type-errors) - [Version 3.0](#version-30) - [Contributing](#contributing) ## Style types Properties are categorized in different uses and in several technical variations to provide typings that suits as many as possible. | | Default | `Hyphen` | `Fallback` | `HyphenFallback` | | -------------- | -------------------- | -------------------------- | ---------------------------- | ---------------------------------- | | **All** | `Properties` | `PropertiesHyphen` | `PropertiesFallback` | `PropertiesHyphenFallback` | | **`Standard`** | `StandardProperties` | `StandardPropertiesHyphen` | `StandardPropertiesFallback` | `StandardPropertiesHyphenFallback` | | **`Vendor`** | `VendorProperties` | `VendorPropertiesHyphen` | `VendorPropertiesFallback` | `VendorPropertiesHyphenFallback` | | **`Obsolete`** | `ObsoleteProperties` | `ObsoletePropertiesHyphen` | `ObsoletePropertiesFallback` | `ObsoletePropertiesHyphenFallback` | | **`Svg`** | `SvgProperties` | `SvgPropertiesHyphen` | `SvgPropertiesFallback` | `SvgPropertiesHyphenFallback` | Categories: - **All** - Includes `Standard`, `Vendor`, `Obsolete` and `Svg` - **`Standard`** - Current properties and extends subcategories `StandardLonghand` and `StandardShorthand` _(e.g. `StandardShorthandProperties`)_ - **`Vendor`** - Vendor prefixed properties and extends subcategories `VendorLonghand` and `VendorShorthand` _(e.g. `VendorShorthandProperties`)_ - **`Obsolete`** - Removed or deprecated properties - **`Svg`** - SVG-specific properties Variations: - **Default** - JavaScript (camel) cased property names - **`Hyphen`** - CSS (kebab) cased property names - **`Fallback`** - Also accepts array of values e.g. `string | string[]` ## At-rule types At-rule interfaces with descriptors. **TypeScript**: These will be found in the `AtRule` namespace, e.g. `AtRule.Viewport`. **Flow**: These will be prefixed with `AtRule$`, e.g. `AtRule$Viewport`. | | Default | `Hyphen` | `Fallback` | `HyphenFallback` | | -------------------- | -------------- | -------------------- | ---------------------- | ---------------------------- | | **`@counter-style`** | `CounterStyle` | `CounterStyleHyphen` | `CounterStyleFallback` | `CounterStyleHyphenFallback` | | **`@font-face`** | `FontFace` | `FontFaceHyphen` | `FontFaceFallback` | `FontFaceHyphenFallback` | | **`@viewport`** | `Viewport` | `ViewportHyphen` | `ViewportFallback` | `ViewportHyphenFallback` | ## Pseudo types String literals of pseudo classes and pseudo elements - `Pseudos` Extends: - `AdvancedPseudos` Function-like pseudos e.g. `:not(:first-child)`. The string literal contains the value excluding the parenthesis: `:not`. These are separated because they require an argument that results in infinite number of variations. - `SimplePseudos` Plain pseudos e.g. `:hover` that can only be **one** variation. ## Generics All interfaces has two optional generic argument to define length and time: `CSS.Properties` - **Length** is the first generic parameter and defaults to `string | 0` because `0` is the only [length where the unit identifier is optional](https://drafts.csswg.org/css-values-3/#lengths). You can specify this, e.g. `string | number`, for platforms and libraries that accepts any numeric value as length with a specific unit. ```tsx const style: CSS.Properties = { width: 100, }; ``` - **Time** is the second generic argument and defaults to `string`. You can specify this, e.g. `string | number`, for platforms and libraries that accepts any numeric value as length with a specific unit. ```tsx const style: CSS.Properties = { transitionDuration: 1000, }; ``` ## Usage ```ts import * as CSS from 'csstype'; const style: CSS.Properties = { width: '10px', margin: '1em', }; ``` In some cases, like for CSS-in-JS libraries, an array of values is a way to provide fallback values in CSS. Using `CSS.PropertiesFallback` instead of `CSS.Properties` will add the possibility to use any property value as an array of values. ```ts import * as CSS from 'csstype'; const style: CSS.PropertiesFallback = { display: ['-webkit-flex', 'flex'], color: 'white', }; ``` There's even string literals for pseudo selectors and elements. ```ts import * as CSS from 'csstype'; const pseudos: { [P in CSS.SimplePseudos]?: CSS.Properties } = { ':hover': { display: 'flex', }, }; ``` Hyphen cased (kebab cased) properties are provided in `CSS.PropertiesHyphen` and `CSS.PropertiesHyphenFallback`. It's not **not** added by default in `CSS.Properties`. To allow both of them, you can simply extend with `CSS.PropertiesHyphen` or/and `CSS.PropertiesHyphenFallback`. ```ts import * as CSS from 'csstype'; interface Style extends CSS.Properties, CSS.PropertiesHyphen {} const style: Style = { 'flex-grow': 1, 'flex-shrink': 0, 'font-weight': 'normal', backgroundColor: 'white', }; ``` Adding type checked CSS properties to a `HTMLElement`. ```ts import * as CSS from 'csstype'; const style: CSS.Properties = { color: 'red', margin: '1em', }; let button = document.createElement('button'); Object.assign(button.style, style); ``` ## What should I do when I get type errors? The goal is to have as perfect types as possible and we're trying to do our best. But with CSS Custom Properties, the CSS specification changing frequently and vendors implementing their own specifications with new releases sometimes causes type errors even if it should work. Here's some steps you could take to get it fixed: _If you're using CSS Custom Properties you can step directly to step 3._ 1. **First of all, make sure you're doing it right.** A type error could also indicate that you're not :wink: - Some CSS specs that some vendors has implemented could have been officially rejected or haven't yet received any official acceptance and are therefor not included - If you're using TypeScript, [type widening](https://blog.mariusschulz.com/2017/02/04/TypeScript-2-1-literal-type-widening) could be the reason you get `Type 'string' is not assignable to...` errors 2. **Have a look in [issues](https://github.com/frenic/csstype/issues) to see if an issue already has been filed. If not, create a new one.** To help us out, please refer to any information you have found. 3. Fix the issue locally with **TypeScript** (Flow further down): - The recommended way is to use **module augmentation**. Here's a few examples: ```ts // My css.d.ts file import * as CSS from 'csstype'; declare module 'csstype' { interface Properties { // Add a missing property WebkitRocketLauncher?: string; // Add a CSS Custom Property '--theme-color'?: 'black' | 'white'; // ...or allow any other property [index: string]: any; } } ``` - The alternative way is to use **type assertion**. Here's a few examples: ```ts const style: CSS.Properties = { // Add a missing property ['WebkitRocketLauncher' as any]: 'launching', // Add a CSS Custom Property ['--theme-color' as any]: 'black', }; ``` Fix the issue locally with **Flow**: - Use **type assertion**. Here's a few examples: ```js const style: $Exact> = { // Add a missing property [('WebkitRocketLauncher': any)]: 'launching', // Add a CSS Custom Property [('--theme-color': any)]: 'black', }; ``` ## Version 3.0 - **All property types are exposed with namespace** TypeScript: `Property.AlignContent` (was `AlignContentProperty` before) Flow: `Property$AlignContent` - **All at-rules are exposed with namespace** TypeScript: `AtRule.FontFace` (was `FontFace` before) Flow: `AtRule$FontFace` - **Data types are NOT exposed** E.g. `Color` and `Box`. Because the generation of data types may suddenly be removed or renamed. - **TypeScript hack for autocompletion** Uses `(string & {})` for literal string unions and `(number & {})` for literal number unions ([related issue](https://github.com/microsoft/TypeScript/issues/29729)). Utilize `PropertyValue` to unpack types from e.g. `(string & {})` to `string`. - **New generic for time** Read more on the ["Generics"](#generics) section. - **Flow types improvements** Flow Strict enabled and exact types are used. ## Contributing **Never modify `index.d.ts` and `index.js.flow` directly. They are generated automatically and committed so that we can easily follow any change it results in.** Therefor it's important that you run `$ git config merge.ours.driver true` after you've forked and cloned. That setting prevents merge conflicts when doing rebase. ### Commands - `npm run build` Generates typings and type checks them - `npm run watch` Runs build on each save - `npm run test` Runs the tests - `npm run lazy` Type checks, lints and formats everything csstype-3.0.10/__tests__/000077500000000000000000000000001414443735000152305ustar00rootroot00000000000000csstype-3.0.10/__tests__/__fixtures__/000077500000000000000000000000001414443735000176755ustar00rootroot00000000000000csstype-3.0.10/__tests__/__fixtures__/.flowconfig000066400000000000000000000004361414443735000220360ustar00rootroot00000000000000[ignore] .*/node_modules/.* [include] ../../index.js.flow [libs] [lints] untyped-import=warn [options] [strict] sketchy-null sketchy-number untyped-type-import unclear-type unsafe-getters-setters nonstrict-import unnecessary-optional-chain unnecessary-invariant deprecated-utility csstype-3.0.10/__tests__/__fixtures__/package-lock.json000066400000000000000000000064261414443735000231210ustar00rootroot00000000000000{ "name": "csstype-fixtures", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "csstype-fixtures", "dependencies": { "csstype": "file:../..", "oldcsstype": "npm:csstype@^2.6.18" } }, "../..": { "version": "3.0.9", "license": "MIT", "devDependencies": { "@types/chokidar": "^2.1.3", "@types/css-tree": "^1.0.6", "@types/jest": "^27.0.1", "@types/jsdom": "^16.2.13", "@types/node": "^16.9.1", "@types/prettier": "^2.3.2", "@types/request": "^2.48.7", "@types/turndown": "^5.0.1", "@typescript-eslint/eslint-plugin": "^4.31.0", "@typescript-eslint/parser": "^4.31.0", "chalk": "^4.1.2", "chokidar": "^3.5.2", "css-tree": "^1.1.3", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "fast-glob": "^3.2.7", "flow-bin": "^0.159.0", "jest": "^27.2.0", "jsdom": "^17.0.0", "mdn-browser-compat-data": "git+https://github.com/mdn/browser-compat-data.git#9660656bb7acc7eee075d2b1ee589cbc2d8da1d0", "mdn-data": "git+https://github.com/mdn/data.git#46942543a1ca2160b85a19e55dfcb33a964daecc", "prettier": "^2.4.0", "request": "^2.88.2", "ts-jest": "^27.0.5", "ts-node": "^10.2.1", "turndown": "^7.1.1", "typescript": "~4.4.3" } }, "node_modules/csstype": { "resolved": "../..", "link": true }, "node_modules/oldcsstype": { "name": "csstype", "version": "2.6.18", "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.18.tgz", "integrity": "sha512-RSU6Hyeg14am3Ah4VZEmeX8H7kLwEEirXe6aU2IPfKNvhXwTflK5HQRDNI0ypQXoqmm+QPyG2IaPuQE5zMwSIQ==" } }, "dependencies": { "csstype": { "version": "file:../..", "requires": { "@types/chokidar": "^2.1.3", "@types/css-tree": "^1.0.6", "@types/jest": "^27.0.1", "@types/jsdom": "^16.2.13", "@types/node": "^16.9.1", "@types/prettier": "^2.3.2", "@types/request": "^2.48.7", "@types/turndown": "^5.0.1", "@typescript-eslint/eslint-plugin": "^4.31.0", "@typescript-eslint/parser": "^4.31.0", "chalk": "^4.1.2", "chokidar": "^3.5.2", "css-tree": "^1.1.3", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "fast-glob": "^3.2.7", "flow-bin": "^0.159.0", "jest": "^27.2.0", "jsdom": "^17.0.0", "mdn-browser-compat-data": "git+https://github.com/mdn/browser-compat-data.git#9660656bb7acc7eee075d2b1ee589cbc2d8da1d0", "mdn-data": "git+https://github.com/mdn/data.git#46942543a1ca2160b85a19e55dfcb33a964daecc", "prettier": "^2.4.0", "request": "^2.88.2", "ts-jest": "^27.0.5", "ts-node": "^10.2.1", "turndown": "^7.1.1", "typescript": "~4.4.3" } }, "oldcsstype": { "version": "npm:csstype@2.6.18", "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.18.tgz", "integrity": "sha512-RSU6Hyeg14am3Ah4VZEmeX8H7kLwEEirXe6aU2IPfKNvhXwTflK5HQRDNI0ypQXoqmm+QPyG2IaPuQE5zMwSIQ==" } } } csstype-3.0.10/__tests__/__fixtures__/package.json000066400000000000000000000002321414443735000221600ustar00rootroot00000000000000{ "name": "csstype-fixtures", "private": true, "dependencies": { "csstype": "file:../..", "oldcsstype": "npm:csstype@^2.6.18" } } csstype-3.0.10/__tests__/__fixtures__/typecheck.js000066400000000000000000000032641414443735000222170ustar00rootroot00000000000000// @flow strict import * as CSS from '../../index.js.flow'; // eslint-disable-next-line @typescript-eslint/no-unused-vars const css: CSS.Properties<> = { flexGrow: 1, flexShrink: 1, flexBasis: 'max-content', flexDirection: 'row', MozAppearance: 'button', msOverflowStyle: 'scrollbar', color: '#abcdef', // Test custom string borderBottomWidth: 'calc(1px)', // This property has `TLength` (but not `string` itself) so // if this fails it may have something to do with default generic values lineHeightStep: '2em', }; // eslint-disable-next-line @typescript-eslint/no-unused-vars const cssWithFallbackValues: CSS.PropertiesFallback<> = { flexGrow: [1], flexShrink: [1], flexBasis: ['max-content'], flexDirection: ['row'], MozAppearance: ['button'], msOverflowStyle: ['scrollbar'], }; // eslint-disable-next-line @typescript-eslint/no-unused-vars const cssWithHyphenProperties: CSS.PropertiesHyphen<> = { 'flex-grow': 1, 'flex-shrink': 0, 'flex-basis': 'max-content', 'flex-direction': 'row', '-moz-appearance': 'button', '-ms-overflow-style': 'scrollbar', }; // eslint-disable-next-line @typescript-eslint/no-unused-vars const cssWithDifferentLength: CSS.Properties = { width: 1, }; // eslint-disable-next-line @typescript-eslint/no-unused-vars const unknownProperty: CSS.Properties<> = { unknownProperty: 1, }; // Should fail but doesn't // eslint-disable-next-line @typescript-eslint/no-unused-vars const cssWithDisallowedValue: CSS.Properties<> = { order: '0', }; // Should fail but doesn't // eslint-disable-next-line @typescript-eslint/no-unused-vars const cssWithDisallowedFallbackValues: CSS.Properties<> = { bottom: [0], order: [0], }; csstype-3.0.10/__tests__/__fixtures__/typecheck.ts000066400000000000000000000104361414443735000222300ustar00rootroot00000000000000import * as CSS from '../..'; // Old CSSType import needs to be AFTER the current one import * as OldCSS from 'oldcsstype'; const css: CSS.Properties = { flexGrow: 1, flexShrink: 1, flexBasis: 'max-content', flexDirection: 'row', MozAppearance: 'button', msOverflowStyle: 'scrollbar', color: '#abcdef', height: undefined, // Test custom string width: 'calc(1px)', // This property has `TLength` (but not `(string & {})` itself) so // if this fails it may have something to do with default generic values lineHeightStep: '2em', }; const cssWithFallbackValues: CSS.PropertiesFallback = { flexGrow: [1], flexShrink: [1], flexBasis: ['max-content'], flexDirection: ['row'], MozAppearance: ['button'], msOverflowStyle: ['scrollbar'], height: undefined, clip: [undefined], }; const cssWithHyphenProperties: CSS.PropertiesHyphen = { 'flex-grow': 1, 'flex-shrink': 0, 'flex-basis': 'max-content', 'flex-direction': 'row', '-moz-appearance': 'button', '-ms-overflow-style': 'scrollbar', }; const cssWithDifferentLength: CSS.Properties<{ px: number }> = { width: { px: 1 }, }; const unknownProperty: CSS.Properties = { unknownProperty: 1, }; const cssWithDisallowedFallbackValues: CSS.Properties = { bottom: [0], order: [0], }; // Tests autocomplete hack const autocompleteHackShouldPass: string & {} = ''; const autocompleteHackShouldFail: string & {} = {}; function autocompleteHackTypeGuardProblem(value: CSS.Property.Width) { if (value === 'auto') { // If this passes it could mean that `CSS.PropertyValue` isn't needed anymore const wouldBeNiceIfThisPassed: 'auto' = value; wouldBeNiceIfThisPassed; } } const propertyValueShouldPass1: CSS.PropertyValue = 'auto'; const propertyValueShouldPass2: CSS.PropertyValue = 0; const propertyValueShouldFail: CSS.PropertyValue = 1; function propertyValue(value: CSS.PropertyValue) { if (value === 'auto') { const shouldPass: 'auto' = value; shouldPass; } if (typeof value === 'number') { const shouldPass: 0 = value; shouldPass; } { const shouldFail = value === 1; shouldFail; } if (Array.isArray(value)) { const arrayValue = value[0]; if (arrayValue === 'auto') { const shouldPass: 'auto' = arrayValue; shouldPass; } if (typeof arrayValue === 'number') { const shouldPass: 0 = arrayValue; shouldPass; } { const shouldFail = arrayValue === 1; shouldFail; } } } propertyValue('auto'); // Should pass propertyValue(['auto']); // Should pass propertyValue(0); // Should pass propertyValue([0]); // Should pass propertyValue(1); // Should fail propertyValue([1]); // Should fail function propertyValueWithAutocompleteHack(arg: CSS.Property.Width | [CSS.Property.Width]) { const value = arg as CSS.PropertyValue; if (value === 'auto') { const shouldPass: 'auto' = value; shouldPass; } if (typeof value === 'number') { const shouldPass: 0 = value; shouldPass; } { const shouldFail = value === 1; shouldFail; } if (Array.isArray(value)) { const arrayValue = value[0]; if (arrayValue === 'auto') { const shouldPass: 'auto' = arrayValue; shouldPass; } if (typeof arrayValue === 'number') { const shouldPass: 0 = arrayValue; shouldPass; } { const shouldFail = arrayValue === 1; shouldFail; } } } propertyValueWithAutocompleteHack('auto'); // Should pass propertyValueWithAutocompleteHack(['auto']); // Should pass propertyValueWithAutocompleteHack(0); // Should pass propertyValueWithAutocompleteHack([0]); // Should pass propertyValueWithAutocompleteHack(1); // Should fail propertyValueWithAutocompleteHack([1]); // Should fail const differentMajorVersions: CSS.Properties = {} as OldCSS.Properties; // eslint-disable-next-line @typescript-eslint/no-unused-vars type DataTypeShouldNotBeExposed = CSS.DataType.Color; css; cssWithFallbackValues; cssWithHyphenProperties; cssWithDifferentLength; unknownProperty; cssWithDisallowedFallbackValues; autocompleteHackShouldPass; autocompleteHackShouldFail; autocompleteHackTypeGuardProblem; propertyValueShouldPass1; propertyValueShouldPass2; propertyValueShouldFail; differentMajorVersions; csstype-3.0.10/__tests__/__snapshots__/000077500000000000000000000000001414443735000200465ustar00rootroot00000000000000csstype-3.0.10/__tests__/__snapshots__/dist.flow.ts.snap000066400000000000000000000024071414443735000232720ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`it detects errors 1`] = `"47:43 - Cannot assign object literal to \`unknownProperty\` because property \`unknownProperty\` is missing in \`Properties\` [1] but exists in object literal [2]. [prop-missing]"`; exports[`it detects errors 2`] = `"54:10 - Cannot assign object literal to \`cssWithDisallowedValue\` because in property \`order\`: [incompatible-type] Either string [1] is incompatible with literal union [2]. Or string [1] is incompatible with number [3]."`; exports[`it detects errors 3`] = `"60:11 - Cannot assign object literal to \`cssWithDisallowedFallbackValues\` because in property \`bottom\`: [incompatible-type] Either array literal [1] is incompatible with literal union [2]. Or array literal [1] is incompatible with string [3]. Or array literal [1] is incompatible with number literal \`0\` [4]. Or array literal [1] is incompatible with string literal \`auto\` [5]. Or array literal [1] is incompatible with string [6]."`; exports[`it detects errors 4`] = `"61:10 - Cannot assign object literal to \`cssWithDisallowedFallbackValues\` because in property \`order\`: [incompatible-type] Either array literal [1] is incompatible with literal union [2]. Or array literal [1] is incompatible with number [3]."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-3.5.ts.snap000066400000000000000000000103351414443735000250330ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 3.5 detects errors 1`] = ` "30:2 - Type 'undefined[]' is not assignable to type '\\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | AspectRatio[] | undefined'. Type 'undefined[]' is not assignable to type 'AspectRatio[]'. Type 'undefined' is not assignable to type 'AspectRatio'." `; exports[`Typescript 3.5 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 3.5 detects errors 3`] = ` "51:2 - Type 'number[]' is not assignable to type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | undefined'. Type 'number[]' is not assignable to type '\\"unset\\"'." `; exports[`Typescript 3.5 detects errors 4`] = ` "52:2 - Type 'number[]' is not assignable to type '\\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | (number & {}) | undefined'. Type 'number[]' is not assignable to type '\\"unset\\"'." `; exports[`Typescript 3.5 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 3.5 detects errors 6`] = ` "62:10 - Type 'Range' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 3.5 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 3.5 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.5 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.5 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 3.5 detects errors 11`] = ` "106:14 - Argument of type '1[]' is not assignable to parameter of type 'string | 0 | (string | 0)[]'. Type '1[]' is not assignable to type '(string | 0)[]'. Type '1' is not assignable to type 'string | 0'." `; exports[`Typescript 3.5 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.5 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.5 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'."`; exports[`Typescript 3.5 detects errors 15`] = ` "144:34 - Argument of type '[1]' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'. Type '[1]' is not assignable to type '[0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 4 more ... | \\"min-intrinsic\\"]'. Type '1' is not assignable to type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 4 more ... | \\"min-intrinsic\\"'." `; exports[`Typescript 3.5 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-3.6.ts.snap000066400000000000000000000103351414443735000250340ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 3.6 detects errors 1`] = ` "30:2 - Type 'undefined[]' is not assignable to type '\\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | AspectRatio[] | undefined'. Type 'undefined[]' is not assignable to type 'AspectRatio[]'. Type 'undefined' is not assignable to type 'AspectRatio'." `; exports[`Typescript 3.6 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 3.6 detects errors 3`] = ` "51:2 - Type 'number[]' is not assignable to type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | undefined'. Type 'number[]' is not assignable to type '\\"unset\\"'." `; exports[`Typescript 3.6 detects errors 4`] = ` "52:2 - Type 'number[]' is not assignable to type '\\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | (number & {}) | undefined'. Type 'number[]' is not assignable to type '\\"unset\\"'." `; exports[`Typescript 3.6 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 3.6 detects errors 6`] = ` "62:10 - Type 'Range' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 3.6 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 3.6 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.6 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.6 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 3.6 detects errors 11`] = ` "106:14 - Argument of type '1[]' is not assignable to parameter of type 'string | 0 | (string | 0)[]'. Type '1[]' is not assignable to type '(string | 0)[]'. Type '1' is not assignable to type 'string | 0'." `; exports[`Typescript 3.6 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.6 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.6 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'."`; exports[`Typescript 3.6 detects errors 15`] = ` "144:34 - Argument of type '[1]' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'. Type '[1]' is not assignable to type '[0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 4 more ... | \\"min-intrinsic\\"]'. Type '1' is not assignable to type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 4 more ... | \\"min-intrinsic\\"'." `; exports[`Typescript 3.6 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-3.7.ts.snap000066400000000000000000000103351414443735000250350ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 3.7 detects errors 1`] = ` "30:2 - Type 'undefined[]' is not assignable to type '\\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | AspectRatio[] | undefined'. Type 'undefined[]' is not assignable to type 'AspectRatio[]'. Type 'undefined' is not assignable to type 'AspectRatio'." `; exports[`Typescript 3.7 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 3.7 detects errors 3`] = ` "51:2 - Type 'number[]' is not assignable to type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | undefined'. Type 'number[]' is not assignable to type '\\"unset\\"'." `; exports[`Typescript 3.7 detects errors 4`] = ` "52:2 - Type 'number[]' is not assignable to type '\\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | (number & {}) | undefined'. Type 'number[]' is not assignable to type '\\"unset\\"'." `; exports[`Typescript 3.7 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 3.7 detects errors 6`] = ` "62:10 - Type 'Range' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 3.7 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 3.7 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.7 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.7 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 3.7 detects errors 11`] = ` "106:14 - Argument of type '1[]' is not assignable to parameter of type 'string | 0 | (string | 0)[]'. Type '1[]' is not assignable to type '(string | 0)[]'. Type '1' is not assignable to type 'string | 0'." `; exports[`Typescript 3.7 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.7 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.7 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'."`; exports[`Typescript 3.7 detects errors 15`] = ` "144:34 - Argument of type '[1]' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'. Type '[1]' is not assignable to type '[0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 4 more ... | \\"min-intrinsic\\"]'. Type '1' is not assignable to type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 4 more ... | \\"min-intrinsic\\"'." `; exports[`Typescript 3.7 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-3.8.ts.snap000066400000000000000000000055451414443735000250450ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 3.8 detects errors 1`] = `"30:9 - Type 'undefined' is not assignable to type 'AspectRatio'."`; exports[`Typescript 3.8 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 3.8 detects errors 3`] = `"51:11 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 3.8 detects errors 4`] = `"52:10 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 3.8 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 3.8 detects errors 6`] = ` "62:10 - Type 'Range' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 3.8 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 3.8 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.8 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.8 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 3.8 detects errors 11`] = `"106:15 - Type 'number' is not assignable to type 'string | 0'."`; exports[`Typescript 3.8 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.8 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.8 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'."`; exports[`Typescript 3.8 detects errors 15`] = `"144:35 - Type '1' is not assignable to type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 4 more ... | \\"min-intrinsic\\"'."`; exports[`Typescript 3.8 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-3.9.ts.snap000066400000000000000000000051561414443735000250440ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 3.9 detects errors 1`] = `"30:9 - Type 'undefined' is not assignable to type 'AspectRatio'."`; exports[`Typescript 3.9 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 3.9 detects errors 3`] = `"51:11 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 3.9 detects errors 4`] = `"52:10 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 3.9 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 3.9 detects errors 6`] = ` "62:10 - Type 'Range' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 3.9 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 3.9 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.9 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.9 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 3.9 detects errors 11`] = `"106:15 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 3.9 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 3.9 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 3.9 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'."`; exports[`Typescript 3.9 detects errors 15`] = `"144:35 - Type '1' is not assignable to type 'Width<0 | (string & {})>'."`; exports[`Typescript 3.9 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-4.0.ts.snap000066400000000000000000000051561414443735000250340ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 4.0 detects errors 1`] = `"30:9 - Type 'undefined' is not assignable to type 'AspectRatio'."`; exports[`Typescript 4.0 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 4.0 detects errors 3`] = `"51:11 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.0 detects errors 4`] = `"52:10 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.0 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 4.0 detects errors 6`] = ` "62:10 - Type 'Range' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 4.0 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.0 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.0 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.0 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 4.0 detects errors 11`] = `"106:15 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.0 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.0 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.0 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'."`; exports[`Typescript 4.0 detects errors 15`] = `"144:35 - Type '1' is not assignable to type 'Width<0 | (string & {})>'."`; exports[`Typescript 4.0 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-4.1.ts.snap000066400000000000000000000051561414443735000250350ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 4.1 detects errors 1`] = `"30:9 - Type 'undefined' is not assignable to type 'AspectRatio'."`; exports[`Typescript 4.1 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 4.1 detects errors 3`] = `"51:11 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.1 detects errors 4`] = `"52:10 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.1 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 4.1 detects errors 6`] = ` "62:10 - Type 'Range' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 4.1 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.1 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.1 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.1 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 4.1 detects errors 11`] = `"106:15 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.1 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.1 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.1 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type '0 | \\"auto\\" | \\"inherit\\" | (string & {}) | \\"-moz-initial\\" | \\"initial\\" | \\"revert\\" | \\"unset\\" | \\"-moz-fit-content\\" | \\"-moz-max-content\\" | \\"-moz-min-content\\" | \\"fit-content\\" | \\"max-content\\" | ... 5 more ... | [...]'."`; exports[`Typescript 4.1 detects errors 15`] = `"144:35 - Type '1' is not assignable to type 'Width<0 | (string & {})>'."`; exports[`Typescript 4.1 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-4.2.ts.snap000066400000000000000000000046651414443735000250420ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 4.2 detects errors 1`] = `"30:9 - Type 'undefined' is not assignable to type 'Clip'."`; exports[`Typescript 4.2 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 4.2 detects errors 3`] = `"51:11 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.2 detects errors 4`] = `"52:10 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.2 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 4.2 detects errors 6`] = ` "62:10 - Type '\\"auto\\" | (string & {})' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 4.2 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.2 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.2 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.2 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 4.2 detects errors 11`] = `"106:15 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.2 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.2 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.2 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type 'Width<0 | (string & {})> | [Width<0 | (string & {})>]'."`; exports[`Typescript 4.2 detects errors 15`] = `"144:35 - Type '1' is not assignable to type 'Width<0 | (string & {})>'."`; exports[`Typescript 4.2 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-4.3.ts.snap000066400000000000000000000046651414443735000250430ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 4.3 detects errors 1`] = `"30:9 - Type 'undefined' is not assignable to type 'Clip'."`; exports[`Typescript 4.3 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 4.3 detects errors 3`] = `"51:11 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.3 detects errors 4`] = `"52:10 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.3 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 4.3 detects errors 6`] = ` "62:10 - Type '\\"auto\\" | (string & {})' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 4.3 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.3 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.3 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.3 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 4.3 detects errors 11`] = `"106:15 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.3 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.3 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.3 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type 'Width<0 | (string & {})> | [Width<0 | (string & {})>]'."`; exports[`Typescript 4.3 detects errors 15`] = `"144:35 - Type '1' is not assignable to type 'Width<0 | (string & {})>'."`; exports[`Typescript 4.3 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/__snapshots__/dist.typescript-latest.ts.snap000066400000000000000000000046651414443735000260330ustar00rootroot00000000000000// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Typescript 4.4 detects errors 1`] = `"30:9 - Type 'undefined' is not assignable to type 'Clip'."`; exports[`Typescript 4.4 detects errors 2`] = ` "47:2 - Type '{ unknownProperty: number; }' is not assignable to type 'Properties<0 | (string & {}), string & {}>'. Object literal may only specify known properties, and 'unknownProperty' does not exist in type 'Properties<0 | (string & {}), string & {}>'." `; exports[`Typescript 4.4 detects errors 3`] = `"51:11 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.4 detects errors 4`] = `"52:10 - Type 'number' is not assignable to type 'string'."`; exports[`Typescript 4.4 detects errors 5`] = ` "57:6 - Type '{}' is not assignable to type 'string & {}'. Type '{}' is not assignable to type 'string'." `; exports[`Typescript 4.4 detects errors 6`] = ` "62:10 - Type '\\"auto\\" | (string & {})' is not assignable to type '\\"auto\\"'. Type 'string & {}' is not assignable to type '\\"auto\\"'." `; exports[`Typescript 4.4 detects errors 7`] = `"69:6 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.4 detects errors 8`] = `"81:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.4 detects errors 9`] = `"95:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.4 detects errors 10`] = `"105:14 - Argument of type '1' is not assignable to parameter of type 'string | 0 | (string | 0)[]'."`; exports[`Typescript 4.4 detects errors 11`] = `"106:15 - Type '1' is not assignable to type 'string | 0'."`; exports[`Typescript 4.4 detects errors 12`] = `"119:23 - This condition will always return 'false' since the types 'string | 0 | (string | 0)[]' and '1' have no overlap."`; exports[`Typescript 4.4 detects errors 13`] = `"133:25 - This condition will always return 'false' since the types 'string | 0' and '1' have no overlap."`; exports[`Typescript 4.4 detects errors 14`] = `"143:34 - Argument of type '1' is not assignable to parameter of type 'Width<0 | (string & {})> | [Width<0 | (string & {})>]'."`; exports[`Typescript 4.4 detects errors 15`] = `"144:35 - Type '1' is not assignable to type 'Width<0 | (string & {})>'."`; exports[`Typescript 4.4 detects errors 16`] = `"149:38 - Namespace '\\"index\\"' has no exported member 'DataType'."`; csstype-3.0.10/__tests__/dist.flow.ts000066400000000000000000000024471414443735000175200ustar00rootroot00000000000000import { spawnSync } from 'child_process'; import * as path from 'path'; const flow: string = require('flow-bin'); test('it detects errors', () => { const { stdout: output } = spawnSync( flow, ['check', path.resolve(__dirname, '__fixtures__/typecheck.js'), '--json'], { stdio: 'pipe', encoding: 'utf8', }, ); const { errors }: IFlowOutput = JSON.parse(output); expect(errors.length).toBe(4); for (const error of errors) { expect(message(error)).toMatchSnapshot(); } }); function message(error: IError) { const { loc: { start: { line, column }, }, descr, } = error.message[0]; return `${line}:${column} - ${descr}`; } interface IExtra { message: IMessage[]; } interface IPosition { line: number; column: number; offset: number; } interface ILocation { source: string; type: string; start: IPosition; end: IPosition; } interface IMessage { context: string; descr: string; type: string; loc: ILocation; path: string; line: number; endline: number; start: number; end: number; } interface IError { kind: string; level: string; suppressions: any[]; extra: IExtra[]; message: IMessage[]; } interface IFlowOutput { flowVersion: string; jsonVersion: string; errors: IError[]; passed: boolean; } csstype-3.0.10/__tests__/dist.typescript-3.5.ts000066400000000000000000000015431414443735000212560ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript3.5'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 3.5', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(3.5); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/dist.typescript-3.6.ts000066400000000000000000000015431414443735000212570ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript3.6'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 3.6', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(3.6); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/dist.typescript-3.7.ts000066400000000000000000000015431414443735000212600ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript3.7'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 3.7', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(3.7); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/dist.typescript-3.8.ts000066400000000000000000000015431414443735000212610ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript3.8'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 3.8', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(3.8); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/dist.typescript-3.9.ts000066400000000000000000000015431414443735000212620ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript3.9'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 3.9', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(3.9); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/dist.typescript-4.0.ts000066400000000000000000000015431414443735000212520ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript4.0'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 4.0', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(4.0); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/dist.typescript-4.1.ts000066400000000000000000000015431414443735000212530ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript4.1'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 4.1', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(4.1); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/dist.typescript-4.2.ts000066400000000000000000000015431414443735000212540ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript4.2'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 4.2', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(4.2); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/dist.typescript-4.3.ts000066400000000000000000000015431414443735000212550ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript4.3'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 4.3', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(4.3); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/dist.typescript-latest.ts000066400000000000000000000015401414443735000222420ustar00rootroot00000000000000import * as path from 'path'; import * as ts from 'typescript'; import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils'; describe('Typescript 4.4', () => { it('detects errors', async () => { const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS); const diagnostics = ts.getPreEmitDiagnostics(program); const errors = diagnostics.map(diagnostic => { const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!); return `${line}:${character} - ${removeAbsolutePaths( ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), )}`; }); expect(Number(ts.versionMajorMinor)).toBe(4.4); expect(errors.length).toBe(16); for (const error of errors) { expect(error).toMatchSnapshot(); } }); }); csstype-3.0.10/__tests__/package-lock.json000066400000000000000000000225021414443735000204450ustar00rootroot00000000000000{ "name": "csstype-test", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "csstype-test", "dependencies": { "csstype": "file:..", "typescript3.5": "npm:typescript@~3.5.0", "typescript3.6": "npm:typescript@~3.6.0", "typescript3.7": "npm:typescript@~3.7.0", "typescript3.8": "npm:typescript@~3.8.0", "typescript3.9": "npm:typescript@~3.9.0", "typescript4.0": "npm:typescript@~4.0.0", "typescript4.1": "npm:typescript@~4.1.0", "typescript4.2": "npm:typescript@~4.2.0", "typescript4.3": "npm:typescript@~4.3.0" } }, "..": { "version": "3.0.9", "license": "MIT", "devDependencies": { "@types/chokidar": "^2.1.3", "@types/css-tree": "^1.0.6", "@types/jest": "^27.0.1", "@types/jsdom": "^16.2.13", "@types/node": "^16.9.1", "@types/prettier": "^2.3.2", "@types/request": "^2.48.7", "@types/turndown": "^5.0.1", "@typescript-eslint/eslint-plugin": "^4.31.0", "@typescript-eslint/parser": "^4.31.0", "chalk": "^4.1.2", "chokidar": "^3.5.2", "css-tree": "^1.1.3", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "fast-glob": "^3.2.7", "flow-bin": "^0.159.0", "jest": "^27.2.0", "jsdom": "^17.0.0", "mdn-browser-compat-data": "git+https://github.com/mdn/browser-compat-data.git#9660656bb7acc7eee075d2b1ee589cbc2d8da1d0", "mdn-data": "git+https://github.com/mdn/data.git#46942543a1ca2160b85a19e55dfcb33a964daecc", "prettier": "^2.4.0", "request": "^2.88.2", "ts-jest": "^27.0.5", "ts-node": "^10.2.1", "turndown": "^7.1.1", "typescript": "~4.4.3" } }, "node_modules/csstype": { "resolved": "..", "link": true }, "node_modules/typescript3.5": { "name": "typescript", "version": "3.5.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/typescript3.6": { "name": "typescript", "version": "3.6.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.5.tgz", "integrity": "sha512-BEjlc0Z06ORZKbtcxGrIvvwYs5hAnuo6TKdNFL55frVDlB+na3z5bsLhFaIxmT+dPWgBIjMo6aNnTOgHHmHgiQ==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/typescript3.7": { "name": "typescript", "version": "3.7.7", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.7.tgz", "integrity": "sha512-MmQdgo/XenfZPvVLtKZOq9jQQvzaUAUpcKW8Z43x9B2fOm4S5g//tPtMweZUIP+SoBqrVPEIm+dJeQ9dfO0QdA==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/typescript3.8": { "name": "typescript", "version": "3.8.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/typescript3.9": { "name": "typescript", "version": "3.9.10", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/typescript4.0": { "name": "typescript", "version": "4.0.8", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/typescript4.1": { "name": "typescript", "version": "4.1.6", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz", "integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/typescript4.2": { "name": "typescript", "version": "4.2.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/typescript4.3": { "name": "typescript", "version": "4.3.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } } }, "dependencies": { "csstype": { "version": "file:..", "requires": { "@types/chokidar": "^2.1.3", "@types/css-tree": "^1.0.6", "@types/jest": "^27.0.1", "@types/jsdom": "^16.2.13", "@types/node": "^16.9.1", "@types/prettier": "^2.3.2", "@types/request": "^2.48.7", "@types/turndown": "^5.0.1", "@typescript-eslint/eslint-plugin": "^4.31.0", "@typescript-eslint/parser": "^4.31.0", "chalk": "^4.1.2", "chokidar": "^3.5.2", "css-tree": "^1.1.3", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "fast-glob": "^3.2.7", "flow-bin": "^0.159.0", "jest": "^27.2.0", "jsdom": "^17.0.0", "mdn-browser-compat-data": "git+https://github.com/mdn/browser-compat-data.git#9660656bb7acc7eee075d2b1ee589cbc2d8da1d0", "mdn-data": "git+https://github.com/mdn/data.git#46942543a1ca2160b85a19e55dfcb33a964daecc", "prettier": "^2.4.0", "request": "^2.88.2", "ts-jest": "^27.0.5", "ts-node": "^10.2.1", "turndown": "^7.1.1", "typescript": "~4.4.3" } }, "typescript3.5": { "version": "npm:typescript@3.5.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==" }, "typescript3.6": { "version": "npm:typescript@3.6.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.5.tgz", "integrity": "sha512-BEjlc0Z06ORZKbtcxGrIvvwYs5hAnuo6TKdNFL55frVDlB+na3z5bsLhFaIxmT+dPWgBIjMo6aNnTOgHHmHgiQ==" }, "typescript3.7": { "version": "npm:typescript@3.7.7", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.7.tgz", "integrity": "sha512-MmQdgo/XenfZPvVLtKZOq9jQQvzaUAUpcKW8Z43x9B2fOm4S5g//tPtMweZUIP+SoBqrVPEIm+dJeQ9dfO0QdA==" }, "typescript3.8": { "version": "npm:typescript@3.8.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==" }, "typescript3.9": { "version": "npm:typescript@3.9.10", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==" }, "typescript4.0": { "version": "npm:typescript@4.0.8", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==" }, "typescript4.1": { "version": "npm:typescript@4.1.6", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz", "integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==" }, "typescript4.2": { "version": "npm:typescript@4.2.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==" }, "typescript4.3": { "version": "npm:typescript@4.3.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==" } } } csstype-3.0.10/__tests__/package.json000066400000000000000000000010201414443735000175070ustar00rootroot00000000000000{ "name": "csstype-test", "private": true, "dependencies": { "csstype": "file:..", "typescript3.5": "npm:typescript@~3.5.0", "typescript3.6": "npm:typescript@~3.6.0", "typescript3.7": "npm:typescript@~3.7.0", "typescript3.8": "npm:typescript@~3.8.0", "typescript3.9": "npm:typescript@~3.9.0", "typescript4.0": "npm:typescript@~4.0.0", "typescript4.1": "npm:typescript@~4.1.0", "typescript4.2": "npm:typescript@~4.2.0", "typescript4.3": "npm:typescript@~4.3.0" } } csstype-3.0.10/__tests__/src.typer.ts000066400000000000000000000066461414443735000175450ustar00rootroot00000000000000import parse from '../src/syntax/parser'; import typer, { Type } from '../src/syntax/typer'; describe('typing', () => { it('types combinators', () => { expect(typer(parse('something another-thing'))).toHaveLength(1); expect(typer(parse('something && another-thing'))).toHaveLength(1); expect(typer(parse('something || another-thing'))).toHaveLength(3); expect(typer(parse('something | another-thing'))).toHaveLength(2); }); it('types components', () => { expect(typer(parse('something | 100 | '))).toMatchObject([ { type: Type.StringLiteral }, { type: Type.NumericLiteral }, { type: Type.DataType }, ]); }); it('types optional components', () => { expect(typer(parse('something another-thing? | 100'))).toMatchObject([ { type: Type.String }, { type: Type.StringLiteral }, { type: Type.NumericLiteral }, ]); expect(typer(parse('something another-thing? yet-another-thing? | 100'))).toMatchObject([ { type: Type.String }, { type: Type.StringLiteral }, { type: Type.NumericLiteral }, ]); expect(typer(parse('something? another-thing yet-another-thing? | 100'))).toMatchObject([ { type: Type.String }, { type: Type.StringLiteral }, { type: Type.NumericLiteral }, ]); expect(typer(parse('something? another-thing? yet-another-thing | 100'))).toMatchObject([ { type: Type.String }, { type: Type.StringLiteral }, { type: Type.NumericLiteral }, ]); expect(typer(parse('something? another-thing? yet-another-thing? | 100'))).toMatchObject([ { type: Type.String }, { type: Type.StringLiteral }, { type: Type.StringLiteral }, { type: Type.StringLiteral }, { type: Type.NumericLiteral }, ]); expect(typer(parse('something another-thing yet-another-thing? | 100'))).toMatchObject([ { type: Type.String }, { type: Type.NumericLiteral }, ]); expect(typer(parse('something another-thing? yet-another-thing | 100'))).toMatchObject([ { type: Type.String }, { type: Type.NumericLiteral }, ]); expect(typer(parse('something? another-thing yet-another-thing | 100'))).toMatchObject([ { type: Type.String }, { type: Type.NumericLiteral }, ]); }); it('does not duplicate types', () => { expect(typer(parse('something? another-thing | something? another-thing | 100 | 100'))).toMatchObject([ { type: Type.String }, { type: Type.StringLiteral }, { type: Type.NumericLiteral }, ]); }); it('types optional group components', () => { expect(typer(parse('[ something another-thing ]? 100'))).toMatchObject([ { type: Type.String }, { type: Type.NumericLiteral }, ]); }); it('types multipliers', () => { expect(typer(parse('something-x | something-y | [ something | another-thing ]{1,2}'))).toMatchObject([ { type: Type.StringLiteral }, { type: Type.StringLiteral }, { type: Type.String }, { type: Type.StringLiteral }, { type: Type.StringLiteral }, ]); expect(typer(parse('something{1,4} [ antoher-thing{1,4} ]?'))).toMatchObject([ { type: Type.String }, { type: Type.StringLiteral }, ]); expect(typer(parse('something#'))).toMatchObject([{ type: Type.String }, { type: Type.StringLiteral }]); }); it('types number with range', () => { expect(typer(parse(''))).toMatchObject([{ type: Type.Number }]); }); }); csstype-3.0.10/__tests__/typescript-utils.ts000066400000000000000000000005741414443735000211520ustar00rootroot00000000000000import * as path from 'path'; export const COMPILER_OPTIONS = { noEmit: true, strict: true, types: [], }; const rootPosixPath = path.resolve(__dirname, '..').replace(/\\/g, '/') + '/'; const rootWin32Path = rootPosixPath.replace(/\//g, '\\'); export function removeAbsolutePaths(message: string) { return message.replace(rootPosixPath, '').replace(rootWin32Path, ''); } csstype-3.0.10/build.ts000066400000000000000000000043701414443735000147450ustar00rootroot00000000000000import * as chokidar from 'chokidar'; import * as path from 'path'; import * as prettier from 'prettier'; import { FLOW_FILENAME, TYPESCRIPT_FILENAME, writeFileAsync } from './utils'; import { runCLI } from 'jest'; if (process.argv.includes('--start')) { trigger() .then(() => { process.exit(0); }) .catch(e => { console.error(e); process.exit(1); }); } else if (process.argv.includes('--watch')) { trigger() .catch(e => { console.error(e); }) .then(() => { console.info('Done! Watching...'); let debounce: NodeJS.Timer; chokidar.watch(path.join(__dirname, 'src'), { ignored: '*.json', ignoreInitial: true }).on('all', () => { clearTimeout(debounce); debounce = setTimeout( () => trigger() .catch(e => console.error(e)) .then(() => console.info('Done! Moving on...')), 300, ); }); }); } export default async function trigger() { console.info('Generating...'); const { unformattedFlow, unformattedTypescript } = await create(); console.info('Formatting...'); const [flow, typescript] = await Promise.all([ format(unformattedFlow, 'flow'), format(unformattedTypescript, 'typescript'), ]); console.info(`Writing files...`); await Promise.all([writeFileAsync(FLOW_FILENAME, flow), writeFileAsync(TYPESCRIPT_FILENAME, typescript)]); console.info('Testing...'); await testing(); } async function create() { const generatePath = path.resolve('./src'); for (const key in require.cache) { if (key.indexOf(generatePath) !== -1) { delete require.cache[key]; } } const { default: generateFlow } = await import('./src/flow'); const { default: generateTypescript } = await import('./src/typescript'); return { unformattedFlow: await generateFlow(), unformattedTypescript: await generateTypescript() }; } async function format(output: string, parser: prettier.BuiltInParserName) { const options = await prettier.resolveConfig(path.join(__dirname, '.prettierrc')); return prettier.format(output, { ...options, printWidth: 180, singleQuote: false, parser, }); } function testing() { return runCLI({ testMatch: ['**/__tests__/dist.*.ts'] } as any, [__dirname]); } csstype-3.0.10/index.d.ts000066400000000000000000032310461414443735000152040ustar00rootroot00000000000000export {}; export type PropertyValue = TValue extends Array ? Array : TValue extends infer TUnpacked & {} ? TUnpacked : TValue; export type Fallback = { [P in keyof T]: T[P] | NonNullable[] }; export interface StandardLonghandProperties { /** * The **`accent-color`** CSS property sets the color of the elements accent. An accent appears in elements such as `` of `type="checkbox"`, or `type="radio"`. * * **Syntax**: `auto | ` * * **Initial value**: `auto` * * | Chrome | Firefox | Safari | Edge | IE | * | :----: | :-----: | :----: | :----: | :-: | * | **93** | **92** | No | **93** | No | * * @see https://developer.mozilla.org/docs/Web/CSS/accent-color */ accentColor?: Property.AccentColor | undefined; /** * The CSS **`align-content`** property sets the distribution of space between and around content items along a flexbox's cross-axis or a grid's block axis. * * **Syntax**: `normal | | | ? ` * * **Initial value**: `normal` * * --- * * _Supported in Flex Layout_ * * | Chrome | Firefox | Safari | Edge | IE | * | :------: | :-----: | :-----: | :----: | :----: | * | **29** | **28** | **9** | **12** | **11** | * | 21 _-x-_ | | 7 _-x-_ | | | * * --- * * _Supported in Grid Layout_ * * | Chrome | Firefox | Safari | Edge | IE | * | :----: | :-----: | :------: | :----: | :-: | * | **57** | **52** | **10.1** | **16** | No | * * --- * * @see https://developer.mozilla.org/docs/Web/CSS/align-content */ alignContent?: Property.AlignContent | undefined; /** * The CSS **`align-items`** property sets the `align-self` value on all direct children as a group. In Flexbox, it controls the alignment of items on the Cross Axis. In Grid Layout, it controls the alignment of items on the Block Axis within their grid area. * * **Syntax**: `normal | stretch | | [ ? ]` * * **Initial value**: `normal` * * --- * * _Supported in Flex Layout_ * * | Chrome | Firefox | Safari | Edge | IE | * | :------: | :-----: | :-----: | :----: | :----: | * | **52** | **20** | **9** | **12** | **11** | * | 21 _-x-_ | | 7 _-x-_ | | | * * --- * * _Supported in Grid Layout_ * * | Chrome | Firefox | Safari | Edge | IE | * | :----: | :-----: | :------: | :----: | :-: | * | **57** | **52** | **10.1** | **16** | No | * * --- * * @see https://developer.mozilla.org/docs/Web/CSS/align-items */ alignItems?: Property.AlignItems | undefined; /** * The **`align-self`** CSS property overrides a grid or flex item's `align-items` value. In Grid, it aligns the item inside the grid area. In Flexbox, it aligns the item on the cross axis. * * **Syntax**: `auto | normal | stretch | | ? ` * * **Initial value**: `auto` * * --- * * _Supported in Flex Layout_ * * | Chrome | Firefox | Safari | Edge | IE | * | :------: | :-----: | :-------: | :----: | :----: | * | **36** | **20** | **9** | **12** | **11** | * | 21 _-x-_ | | 6.1 _-x-_ | | | * * --- * * _Supported in Grid Layout_ * * | Chrome | Firefox | Safari | Edge | IE | * | :----: | :-----: | :------: | :----: | :----------: | * | **57** | **52** | **10.1** | **16** | **10** _-x-_ | * * --- * * @see https://developer.mozilla.org/docs/Web/CSS/align-self */ alignSelf?: Property.AlignSelf | undefined; /** * The **`align-tracks`** CSS property sets the alignment in the masonry axis for grid containers that have masonry in their block axis. * * **Syntax**: `[ normal | | | ? ]#` * * **Initial value**: `normal` * * | Chrome | Firefox | Safari | Edge | IE | * | :----: | :-----: | :----: | :--: | :-: | * | No | n/a | No | No | No | * * @see https://developer.mozilla.org/docs/Web/CSS/align-tracks */ alignTracks?: Property.AlignTracks | undefined; /** * The **`animation-delay`** CSS property specifies the amount of time to wait from applying the animation to an element before beginning to perform the animation. The animation can start later, immediately from its beginning, or immediately and partway through the animation. * * **Syntax**: `