Angular wani tsari ne mai ƙarfi na aikace-aikacen gidan yanar gizo wanda ke amfani da Typescript, HTML, da CSS don isar da aikace-aikacen yanar gizo masu mu'amala sosai. Batu ɗaya gama gari da masu haɓakawa suka ci karo da su yayin aiki tare da Angular shine rashin daidaituwar sigar TypeScript. Kamar yadda saƙon kuskure ya bayyana a sama, “Mai Haɗawa Angular yana buƙatar Rubutun Rubutun>=4.0.0 da <4.1.0 amma an sami 3.4.5 maimakon.” Wannan matsalar ta samo asali ne daga amfani da nau'in TypeScript mara tallafi wanda ba a haɗa shi cikin kewayon daidaitawar Angular compiler.
Don magance wannan matsala akwai takamaiman mafita wanda ya kamata a yi la'akari:
Haɓaka TypeScript da kuma canza saitunan tarawa na Angular .
npm install -g typescript@latest
Wannan umarnin zai haɓaka TypeScript zuwa sabon sigar sa.
Bayanin mataki-mataki
Da fari, kuna buƙatar duba nau'in TypeScript na yanzu tare da umarnin taimako kamar haka:
tsc -v
Na biyu, idan nau'in TypeScript ba ya cikin kewayon da aka yarda da mai tara Angular, yi amfani da umarni mai zuwa don haɓaka TypeScript:
npm shigar typescript@">=4.0.0 <4.1.0" [/ code] Wannan yana tabbatar da samun sabuwar sigar TypeScript mai dacewa.
Ayyuka ko Laburaren da ke da alaƙa
A cikin magance wannan matsala, wasu ayyuka ko ɗakunan karatu suna taka muhimmiyar rawa. npm (Mai sarrafa fakitin Node) buƙatu ne mai mahimmanci. npm yana taimakawa wajen shigar da nau'in TypeScript da ya dace a matsayin mai sarrafa fakitin JavaScript kuma ana iya amfani dashi don saukewa da shigar da ɗakunan karatu na JavaScript daban-daban.
A cikin wannan mahallin, mai tarawa TypeScript 'tsc' kayan aiki ne mai mahimmanci kuma. Yana ba ku damar tattara fayilolinku na TypeScript zuwa JavaScript, yana sa masu binciken gidan yanar gizo za su iya fassara su.
Fahimtar Daidaituwar Angular da TypeScript
Angular da TypeScript suna tafiya hannu da hannu. Angular yana amfani da TypeScript da farko don fasalulluka na bugawa. Buga a tsaye a cikin TypeScript yana ba masu haɓaka damar yin la'akari da nau'in bayanan mai canzawa yayin ayyana shi, wanda, bi da bi, yana ba da tallafin kayan aiki mai ƙarfi yayin haɓakawa.
A ƙarshe, samun nau'in TypeScript daidai yana tabbatar da aiki mara kyau na ayyukan Angular kuma yana guje wa kurakurai da ba zato ba tsammani.
Yin amfani da madaidaicin umarni don sabunta TypeScript zai guje wa rikice-rikice na rashin daidaituwa na sigar.