You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently trying to figure out why I need "skipLibCheck": true in order for compiler to resolve and emit the correct imported type alias. It does not throw any errors because its importing the wrong alias so their types are the same, but I'm losing the correct tsdoc.
BoxShadowProperty & AnimationNameProperty do have the same types- so there wont be any error thrown, however the jsdoc comments become misleading
Code
tsconfig
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"strict": true,
"target": "es5",
"declaration": true,
"declarationDir": "dist-debug/",
"skipLibCheck": true, /// Needs to be true to fix wrong alias types being used
},
"files": ["src/boxShadow.ts"],
}
exporttypeGlobals="-moz-initial"|"inherit"|"initial"|"revert"|"unset";exporttypeStringHack=string&{zz_IGNORE_ME?: never};/** * The **`animation-name`** CSS property sets one or more animations to apply to an element. Each name is an `@keyframes` at-rule that sets the property values for the animation sequence. * * @see https://developer.mozilla.org/docs/Web/CSS/animation-name */exporttypeAnimationNameProperty=Globals|"none"|StringHack;/** * The **`box-shadow`** CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas. A box shadow is described by X and Y offsets relative to the element, blur and spread radii, and color. * * @see https://developer.mozilla.org/docs/Web/CSS/box-shadow */exporttypeBoxShadowProperty=Globals|"none"|StringHack;
For union types the TypeChecker uses the name it first encounters during checking. This name is reused if an equal union type is encountered.
Which name is used solely depends on the order of type checking different nodes in different files.
By turning off lib checking, you are changing that order which incidentally fixes this issue. However, that's not a reliable solution as an unrelated change could cause a change in check order.
To fix the declaration emit, you can add an explicit type annotation to export const boxShadow which is then used by the declaration emitter.
@ajafff - thanks for the explanation. that makes sense and thank you for letting me know that what i thought was a solution was just a coincidence 😞 . Unfortunately adding explicit type annotation may be easy for this simple sample file, but not for remaining parts of the project. At this point it looks like the best thing to do is to remove all annotations from union types to prevent confusing annotations.
btw- i also tried putting each union type in its own file and import that file directly, but that didn't seem to work.
TypeScript Version: 3.4.1 && 3.3.3333
Search Terms: skipLibCheck tsdoc inlineimports wrongaliastype
Currently trying to figure out why I need
"skipLibCheck": true
in order for compiler to resolve and emit the correct imported type alias. It does not throw any errors because its importing the wrong alias so their types are the same, but I'm losing the correct tsdoc.BoxShadowProperty & AnimationNameProperty do have the same types- so there wont be any error thrown, however the jsdoc comments become misleading
Code
tsconfig
@styleaux/tools/src/boxShadow.ts
@styleaux/csstype exports example
Expected behavior:
Occurs only when skipLibCheck =true
Actual behavior:
Occurs only when skipLibCheck =false
Related Issues:
The text was updated successfully, but these errors were encountered: